From 9a360ef9f0f89aa11241279a30f59940942b445b69ddde5a0287c037daac506f Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Thu, 14 Mar 2024 21:08:49 +0300 Subject: [PATCH] More colours --- cd | 2 +- comment-list | 5 +++-- lib.zsh.rc | 13 ++++++++++--- list | 9 ++------- recfile-export | 2 +- recfile-export-all | 2 +- show | 5 +++-- 7 files changed, 21 insertions(+), 17 deletions(-) diff --git a/cd b/cd index b419c6f..0519324 100755 --- a/cd +++ b/cd @@ -3,5 +3,5 @@ root=$0:h:a . $root/lib.zsh.rc -$root/list | fzf -d "\t" --tac --preview="$root/show {2}" | cut -f2 | read d +$root/list | fzf --ansi -d "\t" --tac --preview="$root/show {2}" | cut -f2 | read d print issues/$d diff --git a/comment-list b/comment-list index 284cd72..c2a673c 100755 --- a/comment-list +++ b/comment-list @@ -3,14 +3,15 @@ root=$0:h:a . $root/lib.zsh.rc +[[ -n $NO_COLOR ]] || coloured_git=--color + issue=${1#issues/} hashes=(`git log --format=format:%H issues/$issue/comment`) for i ({${#hashes}..1}) { - header=`git show --no-patch --format=format:"When: %ai%nAuthor: %an <%ae>" ${hashes[$i]}` comment=`git cat-file blob ${hashes[$i]}:issues/$issue/comment | sed "s/^/+ /"` [[ -n $comment ]] || continue + header=`git show $coloured_git --no-patch --format=format:"%CgreenWhen: %ai%Creset%n%CredAuthor: %an <%ae>%Creset%n%CblueComment:%Creset" ${hashes[$i]}` print $header - print Comment: print $comment [[ $i -eq 1 ]] || print } diff --git a/lib.zsh.rc b/lib.zsh.rc index d798d25..fcb1cd3 100644 --- a/lib.zsh.rc +++ b/lib.zsh.rc @@ -22,8 +22,15 @@ dedash() { $PERL -npe 's/([^-])-([^-])/$1 $2/g ; s/-(-+)/$1/g' } +supercat() { cat ; } +if [[ -z $NO_COLOR ]] && command -v spc > /dev/null 2> /dev/null ; then + supercat() { spc $@ ; } +fi + delim() { - local i - for i ({1..40}) print -n -- - - print + { + local i + for i ({1..40}) print -n -- - + print + } | supercat -e mag,".*" } diff --git a/list b/list index 1a47c52..13a1be1 100755 --- a/list +++ b/list @@ -42,10 +42,5 @@ for issue (issues/**/created) { print -n `cat issues/$issue/created`\\t$issue\\t print $tagsTheir -} | sort -r | { - if [[ -z "$NO_COLOR" ]] && command -v spc > /dev/null 2> /dev/null ; then - spc -e grn,"^..................." -e cya," [^ ]*$" -e red," .*\/" - else - cat - fi -} +} | sort -r | +supercat -e grn,"^.{19}" -e cya," [^ ]*$" -e red," .*\/" diff --git a/recfile-export b/recfile-export index 95efcf5..429c177 100755 --- a/recfile-export +++ b/recfile-export @@ -15,4 +15,4 @@ sed "s/^/+ /" < issues/$issue/about print Result: sed "s/^/+ /" < issues/$issue/result print Comments: -$root/comment-list $issue | sed "s/^/+ /" +NO_COLOR=1 $root/comment-list $issue | sed "s/^/+ /" diff --git a/recfile-export-all b/recfile-export-all index fd068b1..df1f8ef 100755 --- a/recfile-export-all +++ b/recfile-export-all @@ -3,7 +3,7 @@ root=$0:h:a . $root/lib.zsh.rc -$root/list | while read line ; do +NO_COLOR=1 $root/list | while read line ; do line=(${=line}) issue=${line[3]} $root/recfile-export $issue diff --git a/show b/show index 7f9d258..2bdc9a4 100755 --- a/show +++ b/show @@ -4,8 +4,9 @@ root=$0:h:a . $root/lib.zsh.rc issue=${1#issues/} -print `cat issues/$issue/created` \| $issue:h \| `print $issue:t | dedash` -$root/tag-list $issue +print $issue:h | supercat -e red,".*" | read proj +print `cat issues/$issue/created` \| $proj/`print $issue:t | dedash` +$root/tag-list $issue | supercat -e cya,".*" deps=(issues/$issue/deps/*(N)) [[ ${#deps} -eq 0 ]] || { delim -- 2.44.0