diff options
| author | typebrook <typebrook@gmail.com> | 2020-01-20 11:28:25 +0800 |
|---|---|---|
| committer | typebrook <typebrook@gmail.com> | 2020-01-20 11:28:25 +0800 |
| commit | a110947e5a673181cbcc14c3e4e92ed30c94efc4 (patch) | |
| tree | 5e01cb5c02e0e7ff1c77eebe1474031262a6695d /scripts/gist | |
| parent | 1ece646af85fbbf55098e2464055278a23352207 (diff) | |
update
Diffstat (limited to 'scripts/gist')
| -rwxr-xr-x | scripts/gist | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/scripts/gist b/scripts/gist index 3d355c5..f7f662a 100755 --- a/scripts/gist +++ b/scripts/gist | |||
| @@ -18,32 +18,35 @@ | |||
| 18 | # | 18 | # |
| 19 | # * clone gist repos which are not in local | 19 | # * clone gist repos which are not in local |
| 20 | # * pull master branch if a local repo is behind its remote | 20 | # * pull master branch if a local repo is behind its remote |
| 21 | # gist [sync | s] | 21 | # gist (sync | s) |
| 22 | # | 22 | # |
| 23 | # * Go to local gist repo | 23 | # * Go to local gist repo |
| 24 | # . gist <number_of_gist_in_list> | 24 | # . gist <number_of_gist_in_list> |
| 25 | # | 25 | # |
| 26 | # * create a new gist with a file and description | 26 | # * create a new gist with files |
| 27 | # gist [new | n] <filename> "<description>" | 27 | # gist (new | n) [-d | --desc "<gist-description>"] <files>... |
| 28 | # | ||
| 29 | # * create a new gist with STDIN | ||
| 30 | # gist (new | n) [-d | --desc "<gist-description>"] [-f | --file <file>] < <file-with-content> | ||
| 28 | # | 31 | # |
| 29 | # * show the detail of a gist | 32 | # * show the detail of a gist |
| 30 | # gist [detail | d] <number_of_gist_in_list> | 33 | # gist (detail | d) <gist_index> |
| 31 | # | 34 | # |
| 32 | # * edit a gist description | 35 | # * edit a gist description |
| 33 | # gist [edit | e] <number_of_gist_in_list> | 36 | # gist (edit | e) <gist_index> |
| 34 | # | 37 | # |
| 35 | # * delete a gist | 38 | # * delete a gist |
| 36 | # gist [delete | D] <number_of_gist_in_list> | 39 | # gist (delete | D) <gist_index>... |
| 37 | # | 40 | # |
| 38 | # * clean removed gists in local | 41 | # * clean removed gists in local |
| 39 | # gist [clean | C] | 42 | # gist (clean | C) |
| 40 | # | 43 | # |
| 41 | # * update a gist | 44 | # * update a gist |
| 42 | # Since now a gist is a local cloned repo | 45 | # Since now a gist is a local cloned repo |
| 43 | # It is your business to do git commit and git push | 46 | # It is your business to do git commit and git push |
| 44 | # | 47 | # |
| 45 | # * show this help message | 48 | # * show this help message |
| 46 | # gist [help | h] | 49 | # gist (help | h) |
| 47 | 50 | ||
| 48 | # define your environmemnts here | 51 | # define your environmemnts here |
| 49 | # TODO support auth prompt, remove personal info here | 52 | # TODO support auth prompt, remove personal info here |
| @@ -201,14 +204,15 @@ _new_file() { | |||
| 201 | 204 | ||
| 202 | _set_gist() { | 205 | _set_gist() { |
| 203 | while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do case $1 in | 206 | while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do case $1 in |
| 204 | -d) | 207 | -d | --desc) |
| 205 | description="$2" | 208 | description="$2" |
| 206 | shift; shift;; | 209 | shift; shift;; |
| 207 | -f) | 210 | -f | --file) |
| 208 | filename="$2" | 211 | filename="$2" |
| 209 | shift; shift;; | 212 | shift; shift;; |
| 210 | esac | 213 | esac |
| 211 | done | 214 | done |
| 215 | if [[ "$1" == '--' ]]; then shift; fi | ||
| 212 | files=$@ | 216 | files=$@ |
| 213 | } | 217 | } |
| 214 | 218 | ||