From 82b76db82cd86693008817806a2c5a160b15b889 Mon Sep 17 00:00:00 2001 From: typebrook Date: Wed, 13 May 2020 16:39:37 +0800 Subject: Refactor mark usage So by default, 'gist lan' won't show starred gists --- gist | 10 +++++++--- 1 file 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 INDEX_FORMAT=('index' 'url' 'tags_string' 'blob_code' 'file_array' 'file_num' 'comment_num' 'author' 'created_at' 'updated_at' 'description') TAG_CHAR='-_[:alnum:]' -[[ ! -t 0 ]] && INPUT=$(cat) -export mark=[^s] # By defaut, only process user's gists, not starred gist +if [[ ! -t 0 ]]; then + INPUT=$(cat) + export mark=. +else + export mark=[^s] # By defaut, only process user's gists, not starred gist +fi # Default configuration [[ ! -t 1 && -z $hint ]] && hint=false @@ -827,7 +831,7 @@ _pin_tags() { # show languages of files in gists _gists_with_languages() { local pattern="($(sed -E 's/([^ ]+)/#\1/g; s/ /|/g' <<<"$@"))" - hint=false mark=${INPUT:+.} display=language _show_list | grep --color=always -Ei "$pattern" + hint=false display=language _show_list | grep --color=always -Ei "$pattern" } _gists_with_range() { -- cgit v1.2.3-70-g09d2