]> git.madduck.net Git - etc/taskwarrior.git/blob - .zsh/zshrc/parts.d/50-taskwarrior

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

directly compare server CA
[etc/taskwarrior.git] / .zsh / zshrc / parts.d / 50-taskwarrior
1 #
2 # taskwarrior shell integration
3 #
4 # Copyright © 2018 martin f. krafft <madduck@madduck.net>
5 # Released under the terms of the Artistic Licence 2.0
6 #
7 # Source repository: http://git.madduck.net/v/etc/zsh.git
8 #
9
10 if whence task >/dev/null; then
11
12   function task_() {
13     local filter cmd args nofilter=0
14     cmd="$1"; shift
15
16     case "$cmd" in
17       (add|attach|call) nofilter=1;;
18     esac
19
20     for i in "$@"; do
21       case "$nofilter@$i" in
22         (0@<->) :;&
23         (0@/*/) filter="${filter:+$filter }$i";;
24         (*) args="${args:+$args }$i";;
25       esac
26     done
27     eval task $filter $cmd $args
28   }
29
30   function task_postpone() {
31     local args
32     for i in scheduled due until wait; do
33       if [[ -n "$(eval task _get "$1"."$i")" ]]; then
34         args="${args:+$args }${i}:${i}+$2"
35       fi
36     done
37     eval task "$1" modify $args
38   }
39
40   alias t\?='alias -rm t t[-+a-z] | sed -r "s,_ ?, ,"'
41   alias ta='task_ add'
42   alias tc='task_ call'
43   alias th='task_ attach'
44   alias tl='task_ all'
45   alias ty='task_ next rc.recurrence=on >/dev/null && task_ sync'
46   alias td='task_ done'
47   alias te='task_ edit'
48   alias tu='task_ undo'
49   alias tm='task_ modify'
50   alias ts='task_ start'
51   alias tw='task_ waiting'
52   alias tp='task_postpone'
53   alias t+='task_ annotate'
54   alias t='task_ ""'
55
56   run_at_most_every 5m \
57     t 2>/dev/null || :
58 fi
59
60 # vim:ft=zsh