import/include/bitbucket.sh

21 lines
450 B
Bash

bitbucket_projects() {
url="$1"
username="$2"
token="$3"
# get all projects
curl --silent \
-u ${username}:${token} \
"${url}/rest/api/1.0/projects/" |
jq -r '.values[] | .key' |
tr '[:upper:]' '[:lower:]'
}
bitbucket_repos() {
url="$1"
username="$2"
token="$3"
curl --silent \
-u ${username}:${token} \
"${url}/rest/api/1.0/projects/$1/repos/" |
jq -r '.values[].name' |
tr '[:upper:]' '[:lower:]'
}