You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
439 B
Plaintext

# curl a graphql query (change /tmp/gitstoken)
curlgl () {
declare uri="$1"
shift
declare q=$(argsorin "$@")
q=${q//\"/\\\"} # escape all the double quotes
q=${q//$'\n'/ } # force single line
q=${q//$'\t'/ } # remove random tabs
declare query='{"query": "'$q'"}'
curl -s -X POST \
-H "Authorization: Bearer $(</tmp/gitstoken)" \
-H 'Content-Type: application/json' \
-d "$query" "$uri" && echo
return $?
}