From 7fd176a7e07d48fc44af22d5da9785b8e60a1004 Mon Sep 17 00:00:00 2001 From: typebrook Date: Fri, 17 Jan 2020 11:33:24 +0800 Subject: update --- scripts/gist | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'scripts/gist') diff --git a/scripts/gist b/scripts/gist index 6f2f78d..2f99b23 100755 --- a/scripts/gist +++ b/scripts/gist @@ -195,9 +195,12 @@ _create_gist() { # update description of a gist _edit_gist() { + [[ ! $1 =~ ^[0-9]+$ ]] && echo not a valid index number && return 1 GIST_ID=$(_gist_id $1) - jq -n --arg DESC "$2" '{ description: ($DESC) }' |\ + echo -n 'Type new description: ' + read DESC + jq -n --arg DESC "$DESC" '{ description: ($DESC) }' |\ curl -X PATCH -H "$auth_header" --data @- $github_api/gists/$GIST_ID > /dev/null && \ _update } @@ -215,7 +218,7 @@ case "$1" in _create_gist $@ ;; edit | e) - _edit_gist "$2" "$3" + _edit_gist "$2" ;; update | u) _update "$2" -- cgit v1.2.3-70-g09d2