summaryrefslogtreecommitdiffhomepage
path: root/tools/todo.sh
diff options
context:
space:
mode:
authorMichael Smith <mikesmiffy128@gmail.com>2021-11-20 03:10:50 +0000
committerMichael Smith <mikesmiffy128@gmail.com>2021-11-20 03:18:08 +0000
commitda6f343032cb01597dc7866e66f091adf3243a62 (patch)
tree870f8cb8e82bb42202ab92bea03fc6ab35ada7ca /tools/todo.sh
Initial public snapshot
With code from Bill. Thanks Bill!
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