summaryrefslogtreecommitdiffhomepage
path: root/tools/todo.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/todo.sh')
-rw-r--r--tools/todo.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/todo.sh b/tools/todo.sh
new file mode 100644
index 0000000..44c7929
--- /dev/null
+++ b/tools/todo.sh
@@ -0,0 +1,35 @@
+# This file is dedicated to the public domain.
+
+todo() {
+ if [ $# = 0 ]; then
+ printf "Active TODO list:\n\n"
+ ls TODO/ | {
+ while read _l; do
+ printf " * %s: " "$_l"
+ head -n1 "TODO/$_l"
+ done
+ }
+ return
+ fi
+ if [ $# != 1 ]; then
+ echo "expected 0 or 1 argument(s)"
+ return
+ fi
+ if [ -f "TODO/$1" ]; then
+ printf "Active TODO item: "
+ _f="TODO/$1"
+ elif [ -f "TODO/.$1" ]; then
+ printf "Inactive TODO item: "
+ _f="TODO/.$1"
+ else
+ echo "TODO item not found: $1"
+ return
+ fi
+ head -n1 "$_f"
+ printf "\n"
+ sed -n '/^====$/,$p' "$_f"
+ printf "====\n\nMentions in project:\n"
+ git grep -Fn "TODO($1)" || echo "<none>"
+}
+
+# vi: sw=4 ts=4 noet tw=80 cc=80