diff options
author | Hsieh Chin Fan <typebrook@gmail.com> | 2020-12-29 10:23:54 +0800 |
---|---|---|
committer | Hsieh Chin Fan <typebrook@gmail.com> | 2020-12-29 10:23:54 +0800 |
commit | dc2f2415ca8336ebb691ec729fdbb2d2934c6612 (patch) | |
tree | d2c73979a78ef60e526bb6c2b41de1e810965501 | |
parent | 33b9c7e993963ca6fcf90d5b4ad451793d71bc96 (diff) |
Refactor code
-rwxr-xr-x | gist | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -449,7 +449,7 @@ _update_gists() { | |||
449 | extra="s0 True b0d2e7e67aa50298fdf8111ae7466b56 #bash,#gist NONE README.md@Markdown,gist@Shell 2 30 typebrook 2019-12-26T06:49:40Z 2020-05-15T13:00:31Z [bash-gist] A bash script for gist management" | 449 | extra="s0 True b0d2e7e67aa50298fdf8111ae7466b56 #bash,#gist NONE README.md@Markdown,gist@Shell 2 30 typebrook 2019-12-26T06:49:40Z 2020-05-15T13:00:31Z [bash-gist] A bash script for gist management" |
450 | [[ $mark == s ]] && echo $extra >> $INDEX | 450 | [[ $mark == s ]] && echo $extra >> $INDEX |
451 | 451 | ||
452 | tac <$fetched_records | nl -s' ' \ | 452 | <$fetched_records tac | nl -s' ' \ |
453 | | while read -r "${INDEX_FORMAT[@]:0:2}" extra; do | 453 | | while read -r "${INDEX_FORMAT[@]:0:2}" extra; do |
454 | local prefix='' | 454 | local prefix='' |
455 | [[ $public == False ]] && prefix=p; [[ $mark == s ]] && prefix=s | 455 | [[ $public == False ]] && prefix=p; [[ $mark == s ]] && prefix=s |
@@ -465,7 +465,7 @@ _update_gists() { | |||
465 | _query_user() { | 465 | _query_user() { |
466 | local fetched_records=$(tmp_file fetched) | 466 | local fetched_records=$(tmp_file fetched) |
467 | route=users/$1/gists _fetch_gists_with_pagnation $fetched_records | 467 | route=users/$1/gists _fetch_gists_with_pagnation $fetched_records |
468 | tac <$fetched_records | nl -s' ' \ | 468 | <$fetched_records tac | nl -s' ' \ |
469 | | while read -r ${INDEX_FORMAT[@]}; do | 469 | | while read -r ${INDEX_FORMAT[@]}; do |
470 | echo $index ${GIST_DOMAIN}/${gist_id} $author $file_num $comment_num $description | cut -c -"$(tput cols)" | 470 | echo $index ${GIST_DOMAIN}/${gist_id} $author $file_num $comment_num $description | cut -c -"$(tput cols)" |
471 | done || { echo "Failed to query $1's gists"; exit 1; } | 471 | done || { echo "Failed to query $1's gists"; exit 1; } |