From e9ed7b3e119af0b296c61e670198df1db952f981 Mon Sep 17 00:00:00 2001 From: Zergling_man Date: Fri, 13 Oct 2023 20:57:42 +1100 Subject: [PATCH] jq now gets upset if passed an empty argument (which is, in fact, distinct to not being passed an argument\!) --- api.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api.sh b/api.sh index 3bb0a95..d30cd91 100644 --- a/api.sh +++ b/api.sh @@ -1,7 +1,7 @@ baseurl(){ if [ -z $INSEC ]; then sec=s; fi; echo "http$sec://$INSTANCE/api/v3/"; } # This needs to be a function so updates to INSTANCE affect it. This is a very old bug lmao #Generics -get(){ curl -s "$(baseurl)$1?${*:3}" | jq "$2"; } +get(){ curl -s "$(baseurl)$1?${*:3}" | jq "${2:-.}"; } getauth(){ get "$1" "$2" "auth=$TOKE&${*:3}"; } post(){ curl -s "$(baseurl)$1" --json "$(echo ${*:2} | jq '.+{"auth":"'$TOKE'"}')"; } # I'm just gonna clone this thing rather than try to palm the -X PUT into post. I can fix it later.