diff options
author | typebrook <typebrook@gmail.com> | 2020-04-07 00:42:04 +0800 |
---|---|---|
committer | typebrook <typebrook@gmail.com> | 2020-04-07 00:42:04 +0800 |
commit | 2ca0a674f43a18d1e52b8038513faf48ed7ace35 (patch) | |
tree | 3d6351b8a36a22e046174b823998da96a2028f3e | |
parent | aea6308dc148858f77723e934440604819ba4581 (diff) |
Fix hint configuration
-rwxr-xr-x | gist | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -61,7 +61,7 @@ CONFIG=~/.config/gist.conf; mkdir -p ~/.config | |||
61 | INDEX_FORMAT=('index' 'url' 'blob_code' 'file_array' 'file_num' 'comment_num' 'author' 'created_at' 'updated_at' 'description') | 61 | INDEX_FORMAT=('index' 'url' 'blob_code' 'file_array' 'file_num' 'comment_num' 'author' 'created_at' 'updated_at' 'description') |
62 | TAG_CHAR='-_[:alnum:]' | 62 | TAG_CHAR='-_[:alnum:]' |
63 | [[ ! -t 0 ]] && INPUT=$(cat) | 63 | [[ ! -t 0 ]] && INPUT=$(cat) |
64 | [[ ! -t 1 && -z $hint ]] && hint=false || hint=true | 64 | [[ ! -t 1 && -z $hint ]] && hint=false |
65 | 65 | ||
66 | auto_sync=true # automatically clone the gist repo | 66 | auto_sync=true # automatically clone the gist repo |
67 | protocol=https | 67 | protocol=https |
@@ -284,7 +284,7 @@ _index_pattern() { | |||
284 | } | 284 | } |
285 | 285 | ||
286 | # Display the list of gist, show username for starred gist | 286 | # Display the list of gist, show username for starred gist |
287 | # If hint=true, print hint to tty. If mark=<pattern>, filter index with regex | 287 | # If hint=false, do not print hint to tty. If mark=<pattern>, filter index with regex |
288 | # If display=tag, print tags instead or url | 288 | # If display=tag, print tags instead or url |
289 | # TODO color private/starred mark | 289 | # TODO color private/starred mark |
290 | _show_list() { | 290 | _show_list() { |
@@ -319,7 +319,7 @@ _show_list() { | |||
319 | local pinned_tags=( $pin ) | 319 | local pinned_tags=( $pin ) |
320 | echo > /dev/tty | 320 | echo > /dev/tty |
321 | echo Pinned tags: "${pinned_tags[*]/#/#} " > /dev/tty | 321 | echo Pinned tags: "${pinned_tags[*]/#/#} " > /dev/tty |
322 | elif [[ -z $INPUT && $hint == 'true' ]]; then | 322 | elif [[ -z $INPUT && $hint != 'false' ]]; then |
323 | local mtime="$(stat -c %y $INDEX | cut -d'.' -f1)" | 323 | local mtime="$(stat -c %y $INDEX | cut -d'.' -f1)" |
324 | echo > /dev/tty | 324 | echo > /dev/tty |
325 | echo "Last updated at $mtime" > /dev/tty | 325 | echo "Last updated at $mtime" > /dev/tty |
@@ -402,7 +402,7 @@ _fetch_gists() { | |||
402 | [[ -z $result ]] && echo 'Not a single valid gist' && return 0 | 402 | [[ -z $result ]] && echo 'Not a single valid gist' && return 0 |
403 | 403 | ||
404 | sed -i'' -Ee "/^${mark:-[^s]}/ d" $INDEX && echo "$result" >> $INDEX | 404 | sed -i'' -Ee "/^${mark:-[^s]}/ d" $INDEX && echo "$result" >> $INDEX |
405 | mark=$mark _show_list | 405 | mark=$mark hint=$hint _show_list |
406 | 406 | ||
407 | [[ $auto_sync == 'true' ]] && (_sync_repos "$1" &> /dev/null &) | 407 | [[ $auto_sync == 'true' ]] && (_sync_repos "$1" &> /dev/null &) |
408 | true | 408 | true |