Skip to content

Commit

Permalink
Don't Throw an error if 'message' is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
isaaclw committed Mar 29, 2022
1 parent 404d3be commit ff6c653
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bin/gister
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ fetchgist() {
mv $gisthome/$1.list $gisthome/$1.list.backup
fi
curl -s -H "Authorization: token $github_oauth_token" "https://api.github.com/$2?per_page=100" | jq . > $gisthome/$1.list.dirty
[ "$(cat "$gisthome/$1.list.dirty" | jq -r .message)" = 'Bad credentials' ] && { echo "Bad Credentials; clear your credentials and re-init"; exit 1; }
[ "$(cat "$gisthome/$1.list.dirty" | jq -r .message?)" = 'Bad credentials' ] && { echo "Bad Credentials; clear your credentials and re-init"; exit 1; }
for i in $(seq 2 100000); do
if ! (curl -s -H "Authorization: token $github_oauth_token" "https://api.github.com/$2?page=$i&per_page=100" | jq '.' | grep --silent '^\[]$'); then
curl -s -H "Authorization: token $github_oauth_token" "https://api.github.com/$2?page=$i&per_page=100" | jq '.' >> $gisthome/$1.list.dirty
Expand Down

0 comments on commit ff6c653

Please sign in to comment.