README | 1 + comment | 25 +++++++++++++++++++++++++ diff --git a/README b/README index 28f75762e3d6344f7851bc3653bf5caae74a6405e1e7c7b3bb3986e83566c4ab..c536bf82e172d7ef1800f863426d4c4b78ee205297f58e2ea9d78189b3497643 100644 --- a/README +++ b/README @@ -115,6 +115,7 @@ "tag-list issue" prints issue's tags if any. "tag-add issue [tags/]tag" adds a tag, as was noticed before. "dep-add issue-dst issue-src" will link issue-src in issues-dst's deps/. "show issue" shows most of issue's information in human friendly way. +"comment" allows you to conveniently add comment. comment-list, recfile-export and recfile-export-all produces recutils'es compatible recfile output, which is machine friendlier. diff --git a/comment b/comment new file mode 100755 index 0000000000000000000000000000000000000000..12c953d520928c9f6783ec2ea7ec94d6aaac59305bb7fc5651a4d5c9f31dea5d --- /dev/null +++ b/comment @@ -0,0 +1,25 @@ +#!/usr/bin/env zsh + +root=$0:h:a +. $root/lib.zsh.rc + +usage() { + die Usage: $0 ISSUE +} + +[[ -n $1 ]] || usage +issue=${1#issues/} +comment=issues/$issue/comment + +perl -i -npe 's/^/# /' $comment +zmodload -F zsh/stat b:zstat +zstat -A ctimePrev +ctime $comment +$EDITOR $comment +zstat -A ctime +ctime $comment +[[ $ctime != $ctimePrev ]] || { + echo Aborting comment >&2 + perl -i -npe 's/^# //' $comment + exit 0 +} +perl -i -ne 'print if $can; if (/^$/) { $can=1 };' $comment +git add $comment