diff options
| -rw-r--r-- | README.md | 2 | ||||
| -rwxr-xr-x | gist | 8 |
2 files changed, 5 insertions, 5 deletions
| @@ -165,7 +165,7 @@ hint=false gist | |||
| 165 | gist 3 --no-action | 165 | gist 3 --no-action |
| 166 | 166 | ||
| 167 | # delete your third gist without confirmation | 167 | # delete your third gist without confirmation |
| 168 | confirm=false gist delete 3 | 168 | gist delete 3 --force |
| 169 | ``` | 169 | ``` |
| 170 | 170 | ||
| 171 | 171 | ||
| @@ -16,7 +16,7 @@ | |||
| 16 | # new, n [-d | --desc <description>] [-p] [-f | --file <file_name>] create a new gist from STDIN | 16 | # new, n [-d | --desc <description>] [-p] [-f | --file <file_name>] create a new gist from STDIN |
| 17 | # detail, d <index_of_gist> Show the detail of a gist | 17 | # detail, d <index_of_gist> Show the detail of a gist |
| 18 | # edit, e <index_of_gist> Edit a gist's description | 18 | # edit, e <index_of_gist> Edit a gist's description |
| 19 | # delete, D <index_of_gist>... Delete a gist | 19 | # delete, D <index_of_gist>... [--force] Delete a gist |
| 20 | # clean, C Clean removed gists in local | 20 | # clean, C Clean removed gists in local |
| 21 | # config, c [token | user | folder | auto_sync | EDITOR | action | protocol [value] ] Do configuration | 21 | # config, c [token | user | folder | auto_sync | EDITOR | action | protocol [value] ] Do configuration |
| 22 | # user, U <user> Get gists from a given Github user | 22 | # user, U <user> Get gists from a given Github user |
| @@ -456,16 +456,16 @@ _goto_gist() { | |||
| 456 | } | 456 | } |
| 457 | 457 | ||
| 458 | # Delete gists with given indices | 458 | # Delete gists with given indices |
| 459 | # Specify confirm=false to suppress confirmation | 459 | # Specify --force to suppress confirmation |
| 460 | _delete_gist() { | 460 | _delete_gist() { |
| 461 | if [[ $confirm != false ]]; then | 461 | if [[ ! $* =~ '--force' ]]; then |
| 462 | read -r -p "Delete gists above? [y/N] " response | 462 | read -r -p "Delete gists above? [y/N] " response |
| 463 | response=${response,,} | 463 | response=${response,,} |
| 464 | [[ ! $response =~ ^(yes|y)$ ]] && return 0 | 464 | [[ ! $response =~ ^(yes|y)$ ]] && return 0 |
| 465 | fi | 465 | fi |
| 466 | 466 | ||
| 467 | for i in "$@"; do | 467 | for i in "$@"; do |
| 468 | _gist_id "$i" || continue | 468 | _gist_id "$i" &> /dev/null || continue |
| 469 | http_method DELETE "$GITHUB_API/gists/$GIST_ID" \ | 469 | http_method DELETE "$GITHUB_API/gists/$GIST_ID" \ |
| 470 | && echo "$i" deleted \ | 470 | && echo "$i" deleted \ |
| 471 | && sed -E -i'' -e "/^$i / d" $INDEX | 471 | && sed -E -i'' -e "/^$i / d" $INDEX |