summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2020-02-01 00:38:51 +0800
committertypebrook <typebrook@gmail.com>2020-02-01 00:38:51 +0800
commit8e688c9761885f855abbeae142f4c4ebbe710c10 (patch)
tree21699a31ab0a010e3cc81b134bea971409b346f7
parent52aa4ebde1151601ae8a35774ca289c5b6d798b8 (diff)
update
-rwxr-xr-xscripts/gist7
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/gist b/scripts/gist
index 762bdfb..e70577b 100755
--- a/scripts/gist
+++ b/scripts/gist
@@ -161,9 +161,10 @@ getConfiguredClient()
161## Allows to call the users configured client without if statements everywhere 161## Allows to call the users configured client without if statements everywhere
162httpGet() 162httpGet()
163{ 163{
164 local header=""
164 case "$configuredClient" in 165 case "$configuredClient" in
165 curl) curl -A curl -s "$@" ;; 166 curl) [[ -n $token ]] && header="--header $AUTH_HEADER"; curl -A curl -s $header "$@" ;;
166 wget) wget -qO- "$@" ;; 167 wget) [[ -n $token ]] && header="--header $AUTH_HEADER"; wget -qO- $header "$@" ;;
167 httpie) http -b GET "$@" ;; 168 httpie) http -b GET "$@" ;;
168 fetch) fetch -q "$@" ;; 169 fetch) fetch -q "$@" ;;
169 esac 170 esac
@@ -247,7 +248,7 @@ _update() {
247 filter='/^[s]/ d' 248 filter='/^[s]/ d'
248 fi 249 fi
249 250
250 local response=$(curl -s -H "$AUTH_HEADER" $GITHUB_API/$route) 251 local response=$(httpGet $GITHUB_API/$route)
251 false && echo Failed to update gists && return 1 252 false && echo Failed to update gists && return 1
252 sed -i "$filter" $INDEX 253 sed -i "$filter" $INDEX
253 echo $response | _parse_response >> $INDEX 254 echo $response | _parse_response >> $INDEX