aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2020-03-29 14:32:54 +0800
committertypebrook <typebrook@gmail.com>2020-03-29 14:33:42 +0800
commit0097971689ed84da1cfadebb47392089d93b3338 (patch)
tree4b410a4beb116f28a5975ad3dd5f15766c567e59
parent69a0543263e793a94507d3cf40da73710eb04774 (diff)
Supress hint message when command is in pipe
-rwxr-xr-xgist10
1 files changed, 5 insertions, 5 deletions
diff --git a/gist b/gist
index ef6a6ba..6564c93 100755
--- a/gist
+++ b/gist
@@ -60,8 +60,8 @@ CONFIG=~/.config/gist.conf; mkdir -p ~/.config
60INDEX_FORMAT=('index' 'url' 'blob_code' 'file_array' 'file_num' 'comment_num' 'author' 'created_at' 'updated_at' 'description') 60INDEX_FORMAT=('index' 'url' 'blob_code' 'file_array' 'file_num' 'comment_num' 'author' 'created_at' 'updated_at' 'description')
61TAG_CHAR='-_[:alnum:]' 61TAG_CHAR='-_[:alnum:]'
62[[ ! -t 0 ]] && INPUT=$(cat) 62[[ ! -t 0 ]] && INPUT=$(cat)
63[[ ! -t 1 && -z $hint ]] && hint=false || hint=true
63 64
64hint=${hint:=true} # default to show hint with list of gist
65auto_sync=true # automatically clone the gist repo 65auto_sync=true # automatically clone the gist repo
66protocol=https 66protocol=https
67 67
@@ -316,10 +316,10 @@ _show_list() {
316 316
317 if [[ $display == 'tag' && -n $pin ]]; then 317 if [[ $display == 'tag' && -n $pin ]]; then
318 local pinned_tags=( $pin ) 318 local pinned_tags=( $pin )
319 echo 319 echo > /dev/tty
320 echo Pinned tags: "${pinned_tags[*]/#/#} " 320 echo Pinned tags: "${pinned_tags[*]/#/#} " > /dev/tty
321 elif [[ -z $INPUT && $hint == 'true' ]]; then 321 elif [[ -z $INPUT && $hint == 'true' ]]; then
322 echo 322 echo > /dev/tty
323 echo 'Run "gist fetch" to keep gists up to date, or "gist help" for more details' > /dev/tty 323 echo 'Run "gist fetch" to keep gists up to date, or "gist help" for more details' > /dev/tty
324 fi 324 fi
325} 325}
@@ -702,7 +702,7 @@ _check_protocol() {
702_tag_gist() { 702_tag_gist() {
703 # if user want to change tags of a gist 703 # if user want to change tags of a gist
704 if [[ -z $@ ]]; then 704 if [[ -z $@ ]]; then
705 display=tag _show_list 705 display=tag mark=${INPUT:+.} _show_list
706 elif _gist_id $1 &>/dev/null; then 706 elif _gist_id $1 &>/dev/null; then
707 _show_detail $1 | sed 3,6d && echo 707 _show_detail $1 | sed 3,6d && echo
708 local desc="$(_get_desc $1)" 708 local desc="$(_get_desc $1)"