From 76e6d01dded802876e77faf80ec335f203be14bb Mon Sep 17 00:00:00 2001 From: typebrook Date: Thu, 12 Mar 2020 23:56:05 +0800 Subject: Replace default action with hint --- gist | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gist b/gist index b303612..361a8f3 100755 --- a/gist +++ b/gist @@ -45,7 +45,6 @@ configuredClient="" GITHUB_API=https://api.github.com CONFIG=~/.config/gist.conf; mkdir -p ~/.config -action="${EDITOR:-vi} ." [[ -z $hint ]] && hint=true # default to show hint with list of gist [[ -z $confirm ]] && confirm=true # default to confirm when deleting gists auto_sync=true # automatically clone the gist repo @@ -417,8 +416,14 @@ _goto_gist() { fi fi - [[ $2 != '--no-action' ]] && cd "$folder/$GIST_ID" && eval "$action" echo "$folder/$GIST_ID" + if [[ -z $action ]]; then + echo > /dev/tty + echo 'hint: set action inside the repo, for example:' > /dev/tty + echo " gist config action 'ls' # ls files of the given gist" > /dev/tty + elif [[ $2 != '--no-action' ]]; then + cd "$folder/$GIST_ID" && eval "$action" + fi } _delete_gist() { -- cgit v1.2.3-70-g09d2