blob: 50b97d69c755fce3e0ea64320d808916d7460d3a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!@bash@/bin/bash
eval "$(pass show work/shell-scripts/secrets)"
LIST_PROJECTS="/_apis/projects?api-version=7.1-preview.4"
AUTH_HEADER="Authorization: Basic $WORK_AZDO_GIT_AUTH"
LIST_REPOSITORIES="/_apis/git/repositories?api-version=7.1-preview.1"
GIT_DIR="$HOME/projects/"
if [ ! -d $GIT_DIR ]; then
mkdir -p $GIT_DIR
fi
MAX_REPOS=20
echo "curl -s -H \"$AUTH_HEADER\" $WORK_AZDO_GIT_ORG_URL$LIST_PROJECTS"
PROJECT=$(curl -s -H "$AUTH_HEADER" $WORK_AZDO_GIT_ORG_URL$LIST_PROJECTS \
| jq '
.value[].name
' \
| xargs -I{} bash -c "
curl -s -H '$AUTH_HEADER' $WORK_AZDO_GIT_ORG_URL/{}$LIST_REPOSITORIES \
| jq '
.value[].name
' \
| awk '{ gsub(/\"/, \"\", \$1); printf \"{}/_git/%s\\n\", \$1 }'
" \
| fzf)
DEST_DIR="$GIT_DIR/$(echo $PROJECT | cut -d '/' -f3)"
if [ ! -d $DEST_DIR ]
then
git clone $WORK_AZDO_GIT_ORG_URL/$PROJECT $DEST_DIR
fi
cd $DEST_DIR
$EDITOR
|