App-git-hub
view release on metacpan or search on metacpan
share/lib/git-hub view on Meta::CPAN
# NOTE: All the commands used to be defined here but now they have been moved
# into various files under the `cmd` directory for better grouping and code
# organization.
#------------------------------------------------------------------------------
# API calling functions:
#------------------------------------------------------------------------------
api-get() { api-call GET "$1" "$2"; }
api-post() { api-call POST "$1" "$2"; }
api-put() { api-call PUT "$1" "$2"; }
api-patch() { api-call PATCH "$1" "$2"; }
api-delete() { api-call DELETE "$1" "$2"; }
# Build a command to make the HTTP call to the API server, make the call, and
# check the result.
api-call() {
format-curl-command "$@"
if "$verbose_output"; then
local cc="${curl_command[@]}"
share/lib/git-hub view on Meta::CPAN
# Cheap trick to make github pretty-print the JSON output.
"$show_output" && user_agent="curl-$user_agent"
[[ "$url" =~ ^https?: ]] || url="$GIT_HUB_API_URI$url"
curl_command=(
curl
--request "$action"
"$url"
)
[ -n "$data" ] || [ "$action" = "PUT" ] && curl_command+=(-d "$data")
if [ -n "$basic_auth" ]; then
local login="$(get-login)"
if [ -n "$GIT_HUB_PASSWORD" ]; then
curl_command+=(-u "$login:$GIT_HUB_PASSWORD")
else
curl_command+=(-u "$login")
fi
if [ -n "$GIT_HUB_2FA_OTP" ]; then
curl_command+=(--header "X-GitHub-OTP: $GIT_HUB_2FA_OTP")
fi
( run in 0.350 second using v1.01-cache-2.11-cpan-c6e0e5ac2a7 )