diff options
author | Hsieh Chin Fan <typebrook@gmail.com> | 2020-07-05 11:00:13 +0800 |
---|---|---|
committer | Hsieh Chin Fan <typebrook@gmail.com> | 2020-07-05 11:00:13 +0800 |
commit | a01b4f296a5f224305ffa5128c76b8fe8ac9e32b (patch) | |
tree | ae8073edfb6eb2eb3882086604e49ea607bc185b | |
parent | a72afce2571ae0ebcdf00e4c76e62abdab5bb272 (diff) |
Refactor print function
-rwxr-xr-x | gist | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -315,6 +315,7 @@ _print_records() { | |||
315 | return 0 | 315 | return 0 |
316 | fi | 316 | fi |
317 | 317 | ||
318 | local PWD=$(pwd) | ||
318 | sed -Ee "/^$mark/ !d; /^$(_index_pattern) / !d" $INDEX \ | 319 | sed -Ee "/^$mark/ !d; /^$(_index_pattern) / !d" $INDEX \ |
319 | | while read -r "${INDEX_FORMAT[@]}"; do | 320 | | while read -r "${INDEX_FORMAT[@]}"; do |
320 | local message="$(printf '%-56s' ${GIST_DOMAIN}/${gist_id})" | 321 | local message="$(printf '%-56s' ${GIST_DOMAIN}/${gist_id})" |
@@ -327,7 +328,7 @@ _print_records() { | |||
327 | fi | 328 | fi |
328 | 329 | ||
329 | local extra="$(printf "%-4s" "$file_num $comment_num")" | 330 | local extra="$(printf "%-4s" "$file_num $comment_num")" |
330 | [[ $(pwd) == $folder/$gist_id ]] && extra="$(tput setaf 13)>>> $(tput sgr0)" | 331 | [[ $PWD == $folder/$gist_id ]] && extra="$(tput setaf 13)>>> $(tput sgr0)" |
331 | local status=''; status=$(_check_repo_status "${folder}/${gist_id}" "$blob_code") | 332 | local status=''; status=$(_check_repo_status "${folder}/${gist_id}" "$blob_code") |
332 | [[ $index =~ ^s ]] && description="$(printf "%-12s" [${author}]) ${description}" | 333 | [[ $index =~ ^s ]] && description="$(printf "%-12s" [${author}]) ${description}" |
333 | 334 | ||