From 3fe2c36c153b22c79effc7122fb8b5c6564c2880 Mon Sep 17 00:00:00 2001 From: typebrook Date: Tue, 26 May 2020 14:09:04 +0800 Subject: Add index to the result of user query --- gist | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gist b/gist index b87da54..d21655c 100755 --- a/gist +++ b/gist @@ -452,9 +452,9 @@ _update_gists() { _query_user() { local fetched_records=$(tmp_file fetched) route=users/$1/gists _fetch_gists_with_pagnation $fetched_records - cat $fetched_records \ - | while read -r ${INDEX_FORMAT[@]#index}; do - echo "$url $author $file_num $comment_num $description" | cut -c -"$(tput cols)" + tac <$fetched_records | nl -s' ' \ + | while read -r ${INDEX_FORMAT[@]}; do + echo $index $url $author $file_num $comment_num $description | cut -c -"$(tput cols)" done || { echo "Failed to query $1's gists"; exit 1; } } -- cgit v1.2.3-70-g09d2