diff options
Diffstat (limited to 'scripts/gist')
-rwxr-xr-x | scripts/gist | 7 |
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" |