summaryrefslogtreecommitdiffhomepage
path: root/scripts/gist
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2020-01-17 11:33:24 +0800
committertypebrook <typebrook@gmail.com>2020-01-17 11:33:24 +0800
commit7fd176a7e07d48fc44af22d5da9785b8e60a1004 (patch)
treeec86900a23102ac25d5b38e5cb698e5ef2d79ee8 /scripts/gist
parentf6b66099e3651fbaac72e83894c301641fcb1859 (diff)
update
Diffstat (limited to 'scripts/gist')
-rwxr-xr-xscripts/gist7
1 files changed, 5 insertions, 2 deletions
diff --git a/scripts/gist b/scripts/gist
index 6f2f78d..2f99b23 100755
--- a/scripts/gist
+++ b/scripts/gist
@@ -195,9 +195,12 @@ _create_gist() {
195 195
196# update description of a gist 196# update description of a gist
197_edit_gist() { 197_edit_gist() {
198 [[ ! $1 =~ ^[0-9]+$ ]] && echo not a valid index number && return 1
198 GIST_ID=$(_gist_id $1) 199 GIST_ID=$(_gist_id $1)
199 200
200 jq -n --arg DESC "$2" '{ description: ($DESC) }' |\ 201 echo -n 'Type new description: '
202 read DESC
203 jq -n --arg DESC "$DESC" '{ description: ($DESC) }' |\
201 curl -X PATCH -H "$auth_header" --data @- $github_api/gists/$GIST_ID > /dev/null && \ 204 curl -X PATCH -H "$auth_header" --data @- $github_api/gists/$GIST_ID > /dev/null && \
202 _update 205 _update
203} 206}
@@ -215,7 +218,7 @@ case "$1" in
215 _create_gist $@ 218 _create_gist $@
216 ;; 219 ;;
217 edit | e) 220 edit | e)
218 _edit_gist "$2" "$3" 221 _edit_gist "$2"
219 ;; 222 ;;
220 update | u) 223 update | u)
221 _update "$2" 224 _update "$2"