README | 34 +++++++++++++++------------------- add | 6 +++--- cd | 2 +- comment | 6 +++--- lib.zsh.rc | 5 +++++ list | 8 ++++---- recfile-export | 12 +++++++----- recfile-export-all | 6 ++---- show | 6 ++++-- diff --git a/README b/README index c536bf82e172d7ef1800f863426d4c4b78ee205297f58e2ea9d78189b3497643..e87c7392481d7a5312c45e63a4fec84b1e887484ad3717c5d588ece5f4646d74 100644 --- a/README +++ b/README @@ -23,19 +23,13 @@ Basically schwabrak is mainly about a convention how to keep issues in files, loosely similar to https://github.com/driusan/PoormanIssueTracker, from which I borrowed idea of replacing spaces with dashes in issue names. -Issues are kept in the issues/ directory. Each issue can be a part of -projects hierarchy: main-project/sub-proj/issue-name. Directory's name -is the issue's brief name. Dashes should be interpreted as spaces and -n > 1 dashes should be interpreted as n-1 dashes when converting the -directory name to a human readable issue title, as PoormanIssueTracker -suggests. The "about" file contains the description of the issue. The -"result" (initially empty) contains the closed issue resolution -information. - -The "created" issue's file contains the datetime it was created. It is -used to help sort issues by date. Unfortunately Git does not keep and -restore mtimes, which would probably eliminate the need of separate -files with the timestamps. +Issues are kept in the issues/ directory. Directory's name is the +issue's brief name, prepended with datetime for sorting purposes. Dashes +should be interpreted as spaces and n > 1 dashes should be interpreted +as n-1 dashes when converting the directory name to a human readable +issue title, as PoormanIssueTracker suggests. The "about" file contains +the description of the issue. The "result" (initially empty) contains +the closed issue resolution information. Each issue can have attached tags. For keeping their set in consistent well-defined state, the tags/ directory above the issues/ contains @@ -49,6 +43,8 @@ It is your choice how to name and deal with them. Want to find all issues in done state? for i (issues/**/tags/status:done) print $i:h:h. This kind of information are all just enumerations. + +Project's name is expected to be "proj:NAME" tag for example. The deps/ subdirectory in each issue can contain symbolic links to another issues, referencing it. Create another kind of links between @@ -68,7 +64,7 @@ The "comment" issue's file is intended to keep the last comment related to the issue. By committing it you automatically accompany it with your (commit's author) name and the time it was added. - $ cat > issues/issues-name/comment <issues/issues-name/comment < issues/$name/created +mkdir -p issues/$name/tags touch issues/$name/about issues/$name/result issues/$name/comment $EDITOR issues/$name/about git add issues/$name diff --git a/cd b/cd index 05193248aa7901a61e75449f7bb3c815c129bbbdd1d248377bb93feaadd3e2be..09cc64fb43f863bf99be65a1ee6f181b1541cd177adbd0f5a9fce2d6d8db65a8 100755 --- a/cd +++ b/cd @@ -3,5 +3,5 @@ root=$0:h:a . $root/lib.zsh.rc -$root/list | fzf --ansi -d "\t" --tac --preview="$root/show {2}" | cut -f2 | read d +$root/list | fzf --ansi --tac --preview="$root/show {1}" | cut -f2 | read d print issues/$d diff --git a/comment b/comment index 3b4e3de682168683d8f3dfac150655adcb041c35bbb1a52bebaa62d951963f81..7f990ed31ec2f2789980fa5addc9bcea7aa85f94d48108186e548c7780bef16b 100755 --- a/comment +++ b/comment @@ -13,7 +13,7 @@ comment=issues/$issue/comment local tmp=`mktemp` trap "rm -f $tmp" HUP PIPE INT QUIT TERM EXIT -{ $PERL -npe 's/^/# /' < $comment ; print } > $tmp +{ $PERL -npe 's/^/# /' <$comment ; print } >$tmp zmodload -F zsh/stat b:zstat zstat -A ctimePrev +ctime $tmp $EDITOR $tmp @@ -23,8 +23,8 @@ echo Aborting comment >&2 exit 0 } if [[ -s $comment ]]; then - $PERL -ne 'print if $can; if (/^$/) { $can=1 };' < $tmp > $comment + $PERL -ne 'print if $can; if (/^$/) { $can=1 };' <$tmp >$comment else - cat < $tmp > $comment + cat <$tmp >$comment fi git add $comment diff --git a/lib.zsh.rc b/lib.zsh.rc index 09e19535e0ac16400b1f0df655461323afee5d43842162faf0f2b60f3eab3260..f00593f142b68987db23f198857e86763bb12dcad47d2260ff095b4b4b58b5c5 100644 --- a/lib.zsh.rc +++ b/lib.zsh.rc @@ -20,6 +20,11 @@ dedash() { $PERL -npe 's/([^-])-([^-])/$1 $2/g ; s/-(-+)/$1/g' } +split-issue() { + local cols=(${(s/-/)1}) + REPLY=("${cols[1]}-${cols[2]}-${cols[3]:s/T/ /}" ${(j/-/)cols[4,-1]}) +} + # Usage: colourise ColourSpec:RegExp [ColourSpec:RegExp ...] # It is intended to be a drop-in replacement for supercat utility. # ColourSpec is comma delimited list of ANSI codes for colour setting. diff --git a/list b/list index 334b772496aa926c368c99ec42ac1be96485048c288cfb4b1ae2ef03b44e3feb..f60ae626436d6a87f0e5a8bfe03dfca808af6e262883a17a810d71b73a9b688e 100755 --- a/list +++ b/list @@ -33,14 +33,14 @@ [[ $satisfied -eq 1 ]] || return 1 } } -for issue (issues/**/created) { - issue=$issue:h +for issue (issues/*(On)) { + issue=$issue:t issue=${issue#issues/} tagsTheir=(`$root/tag-list $issue`) tagsSatisfied $tagsTheir || continue - print -n `cat issues/$issue/created`\\t$issue\\t + print -n $issue "| " print $tagsTheir } | sort -r | -colourise green:"^.{19}" cyan:" .+ " red:"proj:[^ ]+" +colourise green:"^.{19}" bg-cyan:"\|" red:"proj:[^ ]+" diff --git a/recfile-export b/recfile-export index 2d5f07083e660529eec731158cd7a871165ad41865b7d0491cb7570da36edf6d..b4aed74dc1e5f19d51ebb5d3cec0546c45432b6937530f9dffbec66850bdbb46 100755 --- a/recfile-export +++ b/recfile-export @@ -4,18 +4,20 @@ root=$0:h:a . $root/lib.zsh.rc issue=${1#issues/} -print Created: `cat issues/$issue/created` +split-issue $issue +created=${REPLY[1]} +name=${REPLY[2]} print Issue: $issue -print Project: $issue:h -print Name: `print $issue:t | dedash` +print Created: $created +print Name: `print $name | dedash` for tag (`$root/tag-list $issue`) print Tag: $tag for dep (issues/$issue/deps/*(N)) { _dep=$(relative $(realpath $dep)) print Depends: ${_dep#issues/} } print About: -sed "s/^/+ /" < issues/$issue/about +sed "s/^/+ /"