]> 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:

255a7701b9695bbb907ecf37c4b993c7c35bee36
[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 spec cmd args nospec=0
14     cmd="$1"; shift
15     [[ "$cmd" = add ]] && nospec=1
16     for i in "$@"; do
17       case "$nospec@$i" in
18         (0@<->) :;&
19         (0@/*/) spec="${spec:+$spec }$i";;
20         (*) args="${args:+$args }$i";;
21       esac
22     done
23     eval task $spec $cmd $args
24   }
25
26   alias t\?='alias -rm t t[-+a-z] | sed s,_,,'
27   alias ta='task_ add'
28   alias tc='task_ call'
29   alias th='task_ attach'
30   alias tl='task_ all'
31   alias ty='task_ next rc.recurrence=on >/dev/null && task_ sync'
32   alias td='task_ done'
33   alias te='task_ edit'
34   alias tu='task_ undo'
35   alias tm='task_ modify'
36   alias ts='task_ start'
37   alias tw='task_ waiting'
38   alias t+='task_ annotate'
39   alias t='task_ ""'
40
41   run_at_most_every 5m \
42     t 2>/dev/null || :
43 fi
44
45 # vim:ft=zsh