aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authortypebrook <typebrook@gmail.com>2020-03-27 10:57:11 +0800
committertypebrook <typebrook@gmail.com>2020-03-27 10:57:13 +0800
commit3a041ed5c2a25e59de65e1ec8da362308efc04cb (patch)
treefd97cb733a91b1d3cbd7b4a6e83a3ed1444f9cfb
parent8f90b5506ff98271e1e108b8d5bf5a9ecd596261 (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-xgist2
1 files changed, 1 insertions, 1 deletions
diff --git a/gist b/gist
index 0b1a7fb..3a8de1b 100755
--- a/gist
+++ b/gist
@@ -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 ))