diff options
author | typebrook <typebrook@gmail.com> | 2020-05-17 22:44:48 +0800 |
---|---|---|
committer | typebrook <typebrook@gmail.com> | 2020-05-17 22:44:48 +0800 |
commit | b2a3ccd823e9b8c9844702a9b9b696978a89045d (patch) | |
tree | 64997ed80790a553a58303c58cbb82ee6ff00fc6 | |
parent | 8626dcb17701eeab8314ec092b9b520ccd2a072e (diff) |
Refactor code
-rwxr-xr-x | gist | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -278,7 +278,7 @@ _index_pattern() { | |||
278 | if [[ -z "$INPUT" ]]; then | 278 | if [[ -z "$INPUT" ]]; then |
279 | echo .+ | 279 | echo .+ |
280 | else | 280 | else |
281 | echo "($(echo "$INPUT" | sed -Ee '/^ {4,}/ d; s/^ *//; /^$/ q' | cut -d' ' -f1 | xargs | tr ' ' '|'))" | 281 | echo "($(sed -Ee '/^ {4,}/ d; s/^ *//; /^$/ q' <<<"$INPUT" | cut -d' ' -f1 | xargs | tr ' ' '|'))" |
282 | fi | 282 | fi |
283 | } | 283 | } |
284 | 284 | ||
@@ -442,7 +442,7 @@ _update_gists() { | |||
442 | echo $prefix$index $public $extra | 442 | echo $prefix$index $public $extra |
443 | done >> $INDEX | 443 | done >> $INDEX |
444 | 444 | ||
445 | hint=$hint _show_list | 445 | _show_list |
446 | [[ $auto_sync != false ]] && (_sync_repos &> /dev/null &) | 446 | [[ $auto_sync != false ]] && (_sync_repos &> /dev/null &) |
447 | true | 447 | true |
448 | } | 448 | } |
@@ -710,7 +710,7 @@ _create_gist() { | |||
710 | # shellcheck disable=2181 | 710 | # shellcheck disable=2181 |
711 | if [[ $? -eq 0 ]]; then | 711 | if [[ $? -eq 0 ]]; then |
712 | echo 'Gist is created' | 712 | echo 'Gist is created' |
713 | INPUT=$(tail -1 $INDEX | cut -d' ' -f1) hint=false _show_list | tail -1 | 713 | INPUT=$(tail -1 $INDEX | cut -d' ' -f1) hint=false _show_list |
714 | else | 714 | else |
715 | echo 'Failed to create gist' | 715 | echo 'Failed to create gist' |
716 | fi | 716 | fi |