aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2020-05-13 16:39:37 +0800
committertypebrook <typebrook@gmail.com>2020-05-13 16:39:37 +0800
commit82b76db82cd86693008817806a2c5a160b15b889 (patch)
tree76049d28b040d0cb280d4dc01e4c4decc3d02b09
parent6f275d07f26175322489f31c7305b53080247c51 (diff)
Refactor mark usage
So by default, 'gist lan' won't show starred gists
-rwxr-xr-xgist10
1 files changed, 7 insertions, 3 deletions
diff --git a/gist b/gist
index e25b18c..ca9f675 100755
--- a/gist
+++ b/gist
@@ -62,8 +62,12 @@ CONFIG=~/.config/gist.conf; mkdir -p ~/.config
62 62
63INDEX_FORMAT=('index' 'url' 'tags_string' 'blob_code' 'file_array' 'file_num' 'comment_num' 'author' 'created_at' 'updated_at' 'description') 63INDEX_FORMAT=('index' 'url' 'tags_string' 'blob_code' 'file_array' 'file_num' 'comment_num' 'author' 'created_at' 'updated_at' 'description')
64TAG_CHAR='-_[:alnum:]' 64TAG_CHAR='-_[:alnum:]'
65[[ ! -t 0 ]] && INPUT=$(cat) 65if [[ ! -t 0 ]]; then
66export mark=[^s] # By defaut, only process user's gists, not starred gist 66 INPUT=$(cat)
67 export mark=.
68else
69 export mark=[^s] # By defaut, only process user's gists, not starred gist
70fi
67 71
68# Default configuration 72# Default configuration
69[[ ! -t 1 && -z $hint ]] && hint=false 73[[ ! -t 1 && -z $hint ]] && hint=false
@@ -827,7 +831,7 @@ _pin_tags() {
827# show languages of files in gists 831# show languages of files in gists
828_gists_with_languages() { 832_gists_with_languages() {
829 local pattern="($(sed -E 's/([^ ]+)/#\1/g; s/ /|/g' <<<"$@"))" 833 local pattern="($(sed -E 's/([^ ]+)/#\1/g; s/ /|/g' <<<"$@"))"
830 hint=false mark=${INPUT:+.} display=language _show_list | grep --color=always -Ei "$pattern" 834 hint=false display=language _show_list | grep --color=always -Ei "$pattern"
831} 835}
832 836
833_gists_with_range() { 837_gists_with_range() {