diff options
author | typebrook <typebrook@gmail.com> | 2020-03-12 23:56:05 +0800 |
---|---|---|
committer | typebrook <typebrook@gmail.com> | 2020-03-12 23:56:05 +0800 |
commit | 76e6d01dded802876e77faf80ec335f203be14bb (patch) | |
tree | 00ae352c4d1abec8f069d97a00fb4d2064e58c2d | |
parent | f89c1996bdd800f80f05e817280c88e28b55381f (diff) |
Replace default action with hint
-rwxr-xr-x | gist | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -45,7 +45,6 @@ configuredClient="" | |||
45 | GITHUB_API=https://api.github.com | 45 | GITHUB_API=https://api.github.com |
46 | CONFIG=~/.config/gist.conf; mkdir -p ~/.config | 46 | CONFIG=~/.config/gist.conf; mkdir -p ~/.config |
47 | 47 | ||
48 | action="${EDITOR:-vi} ." | ||
49 | [[ -z $hint ]] && hint=true # default to show hint with list of gist | 48 | [[ -z $hint ]] && hint=true # default to show hint with list of gist |
50 | [[ -z $confirm ]] && confirm=true # default to confirm when deleting gists | 49 | [[ -z $confirm ]] && confirm=true # default to confirm when deleting gists |
51 | auto_sync=true # automatically clone the gist repo | 50 | auto_sync=true # automatically clone the gist repo |
@@ -417,8 +416,14 @@ _goto_gist() { | |||
417 | fi | 416 | fi |
418 | fi | 417 | fi |
419 | 418 | ||
420 | [[ $2 != '--no-action' ]] && cd "$folder/$GIST_ID" && eval "$action" | ||
421 | echo "$folder/$GIST_ID" | 419 | echo "$folder/$GIST_ID" |
420 | if [[ -z $action ]]; then | ||
421 | echo > /dev/tty | ||
422 | echo 'hint: set action inside the repo, for example:' > /dev/tty | ||
423 | echo " gist config action 'ls' # ls files of the given gist" > /dev/tty | ||
424 | elif [[ $2 != '--no-action' ]]; then | ||
425 | cd "$folder/$GIST_ID" && eval "$action" | ||
426 | fi | ||
422 | } | 427 | } |
423 | 428 | ||
424 | _delete_gist() { | 429 | _delete_gist() { |