From ec7bc0468e9987549a0c090835ee50393bae32bd Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Tue, 1 Dec 2020 19:09:52 +0000 Subject: [PATCH] updated bitbucket_api.sh --- bitbucket_api.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bitbucket_api.sh b/bitbucket_api.sh index 2029a72e..02edb4ed 100755 --- a/bitbucket_api.sh +++ b/bitbucket_api.sh @@ -91,12 +91,17 @@ usage_args="/path []" 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[@]}" "$@"