From b2a3ccd823e9b8c9844702a9b9b696978a89045d Mon Sep 17 00:00:00 2001 From: typebrook Date: Sun, 17 May 2020 22:44:48 +0800 Subject: Refactor code --- gist | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gist b/gist index edf8452..0091f6f 100755 --- a/gist +++ b/gist @@ -278,7 +278,7 @@ _index_pattern() { if [[ -z "$INPUT" ]]; then echo .+ else - echo "($(echo "$INPUT" | sed -Ee '/^ {4,}/ d; s/^ *//; /^$/ q' | cut -d' ' -f1 | xargs | tr ' ' '|'))" + echo "($(sed -Ee '/^ {4,}/ d; s/^ *//; /^$/ q' <<<"$INPUT" | cut -d' ' -f1 | xargs | tr ' ' '|'))" fi } @@ -442,7 +442,7 @@ _update_gists() { echo $prefix$index $public $extra done >> $INDEX - hint=$hint _show_list + _show_list [[ $auto_sync != false ]] && (_sync_repos &> /dev/null &) true } @@ -710,7 +710,7 @@ _create_gist() { # shellcheck disable=2181 if [[ $? -eq 0 ]]; then echo 'Gist is created' - INPUT=$(tail -1 $INDEX | cut -d' ' -f1) hint=false _show_list | tail -1 + INPUT=$(tail -1 $INDEX | cut -d' ' -f1) hint=false _show_list else echo 'Failed to create gist' fi -- cgit v1.2.3-70-g09d2