diff options
author | typebrook <typebrook@gmail.com> | 2020-03-27 10:57:11 +0800 |
---|---|---|
committer | typebrook <typebrook@gmail.com> | 2020-03-27 10:57:13 +0800 |
commit | 3a041ed5c2a25e59de65e1ec8da362308efc04cb (patch) | |
tree | fd97cb733a91b1d3cbd7b4a6e83a3ed1444f9cfb | |
parent | 8f90b5506ff98271e1e108b8d5bf5a9ecd596261 (diff) |
Reformat index to let pipe easier
Make sure no space in front of index helps commands like 'cut' works
without extra processing
-rwxr-xr-x | gist | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -302,7 +302,7 @@ _show_list() { | |||
302 | description=$(sed -E -e 's/^\[(.+)\]/\\e[33m[\1]\\e[0m/' <<<"$description" | sed "s/ $hashtags$//") | 302 | description=$(sed -E -e 's/^\[(.+)\]/\\e[33m[\1]\\e[0m/' <<<"$description" | sed "s/ $hashtags$//") |
303 | [[ $tag == 'true' ]] && { url="$hashtags"; local width=45; align=' '; extra=''; } | 303 | [[ $tag == 'true' ]] && { url="$hashtags"; local width=45; align=' '; extra=''; } |
304 | 304 | ||
305 | raw_output="$(printf "% 3s" "$index") $(printf "%${align:--}${width:-56}s" "$url") $extra $description" | 305 | raw_output="$(printf "%-3s" "$index") $(printf "%${align:--}${width:-56}s" "$url") $extra $description" |
306 | [[ -n $pin ]] && raw_output="$(_color_pinned_tags "$raw_output")" | 306 | [[ -n $pin ]] && raw_output="$(_color_pinned_tags "$raw_output")" |
307 | decorator=$(( $(grep -o '\\e\[0m' <<<"$raw_output" | wc -l) *9 )) | 307 | decorator=$(( $(grep -o '\\e\[0m' <<<"$raw_output" | wc -l) *9 )) |
308 | echo -e "$raw_output" | cut -c -$(( $(tput cols) +decorator )) | 308 | echo -e "$raw_output" | cut -c -$(( $(tput cols) +decorator )) |