logo

utils

~/.local/bin tools and git-hooks
commit: bd6e10c36fb14dcc0ba181b65ae45aebb4f9baef
parent: b5e31e30274e100c2416a2ff6839d79ecb005720
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Thu, 21 May 2020 10:06:39 +0200

bin/timey-whyme.sh: Add ability to disable headers

Diffstat:

Mbin/timey-whyme.sh23+++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/bin/timey-whyme.sh b/bin/timey-whyme.sh @@ -3,6 +3,7 @@ xdd="${XDG_DATA_DIR:-$HOME/.local/share}/timey-whyme" today="$(date --date=now +%Y-%m-%d)" later="$(date --date=+7days +%Y-%m-%d)" +headers=true usage() { echo "$0"' [t…|c…|h…] @@ -35,16 +36,16 @@ todo_gen() { '.color 1 .TS nowarn; -llll. -_ -.TH +llll.' + $headers && echo \ +'.TH Deadline Nice Description Location .TB _' ( cut -d '#' -f -1 "$xdd/todo.csv" | grep -v '^$' echo "${today},\m[blue],Now" - echo "${later},,In 7 days\m[]" + echo "${later},\m[],In 7 days" ) | sort -n | tr ',' ' ' echo '.TE' } @@ -55,16 +56,16 @@ calendar_gen() { '.color 1 .TS nowarn; -llll. -_ -.TH +llll.' + $headers && echo \ +'.TH Start End Description Location .TB _' ( cut -d '#' -f -1 "$xdd/calendar.csv" | grep -v '^$' echo "${today},\m[blue],Now" - echo "${later},,In 7 days\m[]" + echo "${later},\m[],In 7 days" ) | sort -n | tr ',' ' ' echo '.TE' } @@ -80,6 +81,11 @@ todo() { todo_gen | groff -t -Dutf-8 -Tutf8 | grep -v '^$' } +if [[ "$1" == "-h" ]]; then + headers=false + shift +fi + case "$1" in c*) calendar @@ -92,6 +98,7 @@ case "$1" in ;; *) todo + echo calendar ;; esac