From a01b4f296a5f224305ffa5128c76b8fe8ac9e32b Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Sun, 5 Jul 2020 11:00:13 +0800 Subject: Refactor print function --- gist | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gist b/gist index 95fc6da..f017e8e 100755 --- a/gist +++ b/gist @@ -315,6 +315,7 @@ _print_records() { return 0 fi + local PWD=$(pwd) sed -Ee "/^$mark/ !d; /^$(_index_pattern) / !d" $INDEX \ | while read -r "${INDEX_FORMAT[@]}"; do local message="$(printf '%-56s' ${GIST_DOMAIN}/${gist_id})" @@ -327,7 +328,7 @@ _print_records() { fi local extra="$(printf "%-4s" "$file_num $comment_num")" - [[ $(pwd) == $folder/$gist_id ]] && extra="$(tput setaf 13)>>> $(tput sgr0)" + [[ $PWD == $folder/$gist_id ]] && extra="$(tput setaf 13)>>> $(tput sgr0)" local status=''; status=$(_check_repo_status "${folder}/${gist_id}" "$blob_code") [[ $index =~ ^s ]] && description="$(printf "%-12s" [${author}]) ${description}" -- cgit v1.2.3-70-g09d2