diff options
| author | typebrook <typebrook@gmail.com> | 2020-05-13 16:39:37 +0800 |
|---|---|---|
| committer | typebrook <typebrook@gmail.com> | 2020-05-13 16:39:37 +0800 |
| commit | 82b76db82cd86693008817806a2c5a160b15b889 (patch) | |
| tree | 76049d28b040d0cb280d4dc01e4c4decc3d02b09 | |
| parent | 6f275d07f26175322489f31c7305b53080247c51 (diff) | |
Refactor mark usage
So by default, 'gist lan' won't show starred gists
| -rwxr-xr-x | gist | 10 |
1 files changed, 7 insertions, 3 deletions
| @@ -62,8 +62,12 @@ CONFIG=~/.config/gist.conf; mkdir -p ~/.config | |||
| 62 | 62 | ||
| 63 | INDEX_FORMAT=('index' 'url' 'tags_string' 'blob_code' 'file_array' 'file_num' 'comment_num' 'author' 'created_at' 'updated_at' 'description') | 63 | INDEX_FORMAT=('index' 'url' 'tags_string' 'blob_code' 'file_array' 'file_num' 'comment_num' 'author' 'created_at' 'updated_at' 'description') |
| 64 | TAG_CHAR='-_[:alnum:]' | 64 | TAG_CHAR='-_[:alnum:]' |
| 65 | [[ ! -t 0 ]] && INPUT=$(cat) | 65 | if [[ ! -t 0 ]]; then |
| 66 | export mark=[^s] # By defaut, only process user's gists, not starred gist | 66 | INPUT=$(cat) |
| 67 | export mark=. | ||
| 68 | else | ||
| 69 | export mark=[^s] # By defaut, only process user's gists, not starred gist | ||
| 70 | fi | ||
| 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() { |