From 6f275d07f26175322489f31c7305b53080247c51 Mon Sep 17 00:00:00 2001 From: typebrook Date: Wed, 13 May 2020 16:39:25 +0800 Subject: Show status with description, do not override file_num and comment_num --- gist | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gist b/gist index 5938009..e25b18c 100755 --- a/gist +++ b/gist @@ -334,18 +334,20 @@ _show_list() { if [[ $display == 'tag' ]]; then local tags=( ${tags_string//,/ } ); message="${tags[@]}" [[ $show_untagged == 'false' && ${#tags[@]} == '0' ]] && continue - local width=45; local align=' '; extra=''; + local width=45; local align=' '; elif [[ $display == 'language' ]]; then message="$(tr ',' '\n' <<< $file_array | sed -Ee 's/.+@/#/' | uniq | xargs)" - local width=45; local align=' '; extra=''; + local width=45; local align=' '; fi - local extra=$(_check_repo_status "$folder/${url##*/}" "$blob_code") - [[ -z $extra ]] && extra="$(printf "%-4s" "$file_num $comment_num")" + local status='' + status=$(_check_repo_status "$folder/${url##*/}" "$blob_code") + status="${status:+${status} }" + local extra="$(printf "%-4s" "$file_num $comment_num")" [[ $index =~ ^s ]] && description="$(printf "%-12s" [${author}]) ${description}" - raw_output="$(printf "%-3s" "$index") $(printf "%${align:--}${width:-56}s" "$message") $extra $(_color_description_title "$description")" + raw_output="$(printf "%-3s" "$index") $(printf "%${align:--}${width:-56}s" "$message") $extra $status$(_color_description_title "$description")" [[ -n $pin ]] && raw_output="$(_color_pinned_tags "$raw_output")" decorator=$(( $(grep -o '\\e\[0m' <<<"$raw_output" | wc -l) *9 )) echo -e "$raw_output" | cut -c -$(( $(tput cols) +decorator )) -- cgit v1.2.3-70-g09d2