summaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2020-01-31 14:56:41 +0800
committertypebrook <typebrook@gmail.com>2020-01-31 14:56:41 +0800
commit85d5cc6965fbc4f7937b681c01c4c1936cec6b22 (patch)
treedf6216399a3ca11e139cceda3c4b587fede9cf0d /scripts
parentb15b3055c0d34c677b92c0ced2eca56ee5a4d055 (diff)
update
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/gist4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/gist b/scripts/gist
index 65e5565..405b48a 100755
--- a/scripts/gist
+++ b/scripts/gist
@@ -220,6 +220,7 @@ _parse_response() {
220 | while read index link file_url_array public file_num comment_num description; do 220 | while read index link file_url_array public file_num comment_num description; do
221 local blob_code=$(echo $file_url_array | tr ',' '\n' | sed -E 's#.*raw/(.*)/.*#\1#' | sort | cut -c -7 | paste -sd '-') 221 local blob_code=$(echo $file_url_array | tr ',' '\n' | sed -E 's#.*raw/(.*)/.*#\1#' | sort | cut -c -7 | paste -sd '-')
222 [[ $public == 'False' ]] && mark=p 222 [[ $public == 'False' ]] && mark=p
223 [[ -n $1 ]] && index=$1
223 echo $mark$index $link $blob_code $file_num $comment_num $description | tr -d '"' 224 echo $mark$index $link $blob_code $file_num $comment_num $description | tr -d '"'
224 done 225 done
225} 226}
@@ -382,7 +383,6 @@ _new_file() {
382} 383}
383 384
384# create a new gist with files 385# create a new gist with files
385# FIXME incorrect index
386# FIXME catch status code from curl if it fails 386# FIXME catch status code from curl if it fails
387_create_gist() { 387_create_gist() {
388 _set_gist "$@" || return 1 388 _set_gist "$@" || return 1
@@ -395,7 +395,7 @@ _create_gist() {
395 | echo "{ \"public\": $public, \"files\": $(cat -), \"description\": \"$description\"}" \ 395 | echo "{ \"public\": $public, \"files\": $(cat -), \"description\": \"$description\"}" \
396 | curl -s -H "$auth_header" --data @- $GITHUB_API/gists \ 396 | curl -s -H "$auth_header" --data @- $GITHUB_API/gists \
397 | sed '1 s/^/[/; $ s/$/]/' \ 397 | sed '1 s/^/[/; $ s/$/]/' \
398 | _parse_response >> $INDEX \ 398 | _parse_response $(( $(sed '/^s/ d' $INDEX | wc -l) +1 )) >> $INDEX \
399 && echo -e '\nGist created' \ 399 && echo -e '\nGist created' \
400 || echo 'Fail to create gist' 400 || echo 'Fail to create gist'
401 401