]> git.rmz.io Git - dotfiles.git/blob - zsh/lib/50-taskwarrior.zsh
4e6c8487a6802616c581d82e14dbb1c5fc85da5e
[dotfiles.git] / zsh / lib / 50-taskwarrior.zsh
1 if (( ! $+commands[task] )); then
2 return 1
3 fi
4
5 alias task="noglob task"
6 alias t="task"
7 alias tt="task today"
8
9 alias in="task add +in"
10 alias inn="in rc.context=none"
11
12 alias tw="task context wfh"
13 alias th="task context home"
14
15 alias tlatest="t +LATEST"
16
17 autoload -Uz task-quote-magic
18 zle -N self-insert task-quote-magic
19
20 function tparent() {
21 # TODO: check args
22 task _get $1.rparent
23 }
24
25 function tick() {
26 # TODO: have duration as an option to allow multiple filter
27 if (( # < 1 || # > 2)); then
28 print >&2 "Usage: $0 <filter> [duration]"
29 return 1
30 fi
31 task $1 mod wait:${2:-1h}
32 }
33
34 function turg() {
35 local context=$(task _get rc.context)
36 local context_read=$(task _get rc.context.$context.read)
37 local urg_task=$(task +READY $context_read _urgency | sort -k4 -n | tail -1 | cut -d" " -f2)
38 task $urg_task $@
39 }
40
41 # TODO: function to show the latest report
42
43 function task_today_list() {
44 local task_cmd=(task rc.verbose:nothing)
45 local task_count=$($task_cmd $($task_cmd _get rc.report.today.filter) count)
46
47 local task_status=""
48 task_status+="%{$fg_bold[red]%} $task_count "
49 task_status+="%{$reset_color%}"
50 echo $task_status
51 }