updated bitbucket_api.sh

pull/2/head
Hari Sekhon 4 years ago
parent 3e167dec41
commit ec7bc0468e

@ -91,12 +91,17 @@ usage_args="/path [<curl_options>]"
url_base="https://api.bitbucket.org/2.0"
CURL_OPTS="-sS --fail --connect-timeout 3 ${CURL_OPTS:-}"
help_usage "$@"
min_args 1 "$@"
# arrays can't be exported so have to pass as a string and then split to array
if [ -n "${CURL_OPTS:-}" ]; then
read -r -a CURL_OPTS <<< "$CURL_OPTS"
else
read -r -a CURL_OPTS <<< "-sS --fail --connect-timeout 3"
fi
user="${BITBUCKET_USERNAME:-${BITBUCKET_USER:-}}"
PASSWORD="${BITBUCKET_PASSWORD:-${BITBUCKET_TOKEN:-}}"
@ -143,4 +148,4 @@ url_path="${url_path/:repo/$repo}"
# need CURL_OPTS splitting, safer than eval
# shellcheck disable=SC2086
"$srcdir/curl_auth.sh" "$url_base/$url_path" "$@" ${CURL_OPTS:-}
"$srcdir/curl_auth.sh" "$url_base/$url_path" "${CURL_OPTS[@]}" "$@"

Loading…
Cancel
Save