From 3a041ed5c2a25e59de65e1ec8da362308efc04cb Mon Sep 17 00:00:00 2001 From: typebrook Date: Fri, 27 Mar 2020 10:57:11 +0800 Subject: Reformat index to let pipe easier Make sure no space in front of index helps commands like 'cut' works without extra processing --- gist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gist b/gist index 0b1a7fb..3a8de1b 100755 --- a/gist +++ b/gist @@ -302,7 +302,7 @@ _show_list() { description=$(sed -E -e 's/^\[(.+)\]/\\e[33m[\1]\\e[0m/' <<<"$description" | sed "s/ $hashtags$//") [[ $tag == 'true' ]] && { url="$hashtags"; local width=45; align=' '; extra=''; } - raw_output="$(printf "% 3s" "$index") $(printf "%${align:--}${width:-56}s" "$url") $extra $description" + raw_output="$(printf "%-3s" "$index") $(printf "%${align:--}${width:-56}s" "$url") $extra $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