summaryrefslogtreecommitdiff
path: root/.local/bin/todotable
diff options
context:
space:
mode:
authorBenjamin Chausse <benjamin@chausse.xyz>2020-10-03 19:27:15 -0400
committerBenjamin Chausse <benjamin@chausse.xyz>2020-10-03 19:27:15 -0400
commite371d9edd474bcf89cf5d462eaccb8638900b390 (patch)
treeed07118f5c514a55f23a779a1507640e46fd9ed2 /.local/bin/todotable
Initial commit
Diffstat (limited to '.local/bin/todotable')
-rwxr-xr-x.local/bin/todotable23
1 files changed, 23 insertions, 0 deletions
diff --git a/.local/bin/todotable b/.local/bin/todotable
new file mode 100755
index 0000000..6609a1f
--- /dev/null
+++ b/.local/bin/todotable
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+file=$(readlink -f "$1")
+dir=$(dirname "$file")
+base="${file%.*}"
+
+contents="$1"
+shift
+for i in "$@"; do
+ output=$output"\n"$(cat "$contents" | grep -n "$i" | sed 's/\([0-9]*\):.*'"$i"'.\(.*\)$/-\ \*\*'"$i"':\*\*\ \2\ (line \1)/g'
+ )
+done
+
+
+if [ "$#" -eq $(printf $output | wc -l ) ];
+then
+ rm "$base"-tdtable.pdf
+ exit 0
+else
+ echo -e '---\ntitle: Checklist:\n.PP'"$output" | groffdown | refer -PS -e "-p$REFERBIB" | groff -me -ms -kejpt -T pdf > "$base"-tdtable.pdf
+fi
+# Uncomment for debugging:
+# echo -e '---\ntitle: TODOs\n.PP'"$output" > "$base"-tdtable.gd