Sets the description of a BitBucket.org repo via the BitBucket API
Uses the adjacent script bitbucket_api.sh, see there for authentication details
\$CURL_OPTS can be set to provide extra arguments to curl
Repo should be specified as <workspace>/<repo> using the slugs which are usually just the same as the username and repo lowercase (they're case sensitive, eg. harisekhon/devops-bash-tools)
Repo workspace prefix, if not set, is assumed to be the username and will use \$BITBUCKET_USER if available, otherwise will query the BitBucket API to determine it
${0##*/} harisekhon/devops-bash-tools my new description
If no args are given, will readread and description from standard input for easy chaining with other tools, can easily update multiple repositories this way, one repo + description per line:
echo <repo> <description> |${0##*/}
"
# used by usage() in lib/utils.sh
# shellcheck disable=SC2034
usage_args="<repo> <description>"
help_usage "$@"
#min_args 2 "$@"
set_repo_description(){
localrepo="$1"
localdescription="${*:2}"
if ! [["$repo"=~ / ]];then
log "no username prefix in repo '$repo', will auto-add it"
# refuse bitbucket_user between function calls for efficiency to save additional queries to the BitBucket API
if[ -z "${bitbucket_user:-}"];then
log "attempting to infer username"
if[ -n "${BITBUCKET_USER:-}"];then
bitbucket_user="$BITBUCKET_USER"
log "using username '$bitbucket_user' from \$BITBUCKET_USER"
else
log "querying BitBucket API for currently authenticated username"