dotfiles/office/.config/sh/alias.d/taskwarrior.sh
Marty Oehme b6e3af4593
taskwarrior: Split today alias into scheduled and due
`td` will display things that are either due today or in the past, or
scheduled today or in the past.
`TD` will _only_ display things that are explicitly due today or in the
past.
2025-11-14 10:27:02 +01:00

56 lines
1.6 KiB
Bash

#!/usr/bin/env sh
# invoking t starts the task shell
# passing arguments along passes them straight through to taskwarrior instead
t() {
# check for existence of tasksh before doing this whole song and dance
if type tasksh >/dev/null 2>&1 && [ "$#" -eq 0 ]; then
tasksh
else
task "$@"
fi
}
# copy the `task` zsh completions over to my little alias 😉
# FIXME: this is not very pretty and not super portable (needs ps) but
# works for now. from here: https://unix.stackexchange.com/a/72564/414758
if echo "$SHELL" | grep -q zsh; then
if exist task && [ "$(ps -p $$ -o comm --no-headers)" = "zsh" ]; then compdef t=task; fi
fi
alias ta="task add"
alias tal="task log"
alias tan="task annotate"
alias tn="task next +READY"
alias td="task +TODAY or +OVERDUE or sched.before:tom" # scheduled and due for today or before
alias TD="task +TODAY or +OVERDUE" # DUE today or before
alias tun="task next urgency \> 4"
if exist timew; then
alias tra="task active && timew"
else
alias tra="task active"
fi
alias tdd="task end.after:today all" # done doday
alias tdy="task end.after:yesterday all" # done yesterday-today
alias tdw="task end.after:today-1wk completed" # done this week
alias tad="task +ACTIVE done"
alias tas="task +ACTIVE stop"
alias to="task note"
#---
# Additional idea repository
idea() {
if [ "$1" = "note" ]; then
shift
idean "$@"
fi
task rc.data.location="$TASK_DATA_IDEA" "$@"
}
idean() {
topen --task-data "$TASK_DATA_IDEA" --notes-dir "$TASK_DATA_IDEA/notes" "$@"
}