]> git.madduck.net Git - etc/taskwarrior.git/blob - .bin/task_call

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:

ignore shift-recurrence files
[etc/taskwarrior.git] / .bin / task_call
1 #!/bin/sh
2 set -eu
3
4 if [ $# != 1 ]; then
5   echo >&2 E: Need exactly one argument.
6   return 1
7 fi
8
9 TSK="$1"
10
11 DATA="$(task _get "$TSK".data)"
12 DATATYPE="${DATA%%:*}"
13 DATAPAYL="${DATA#*:}"
14
15 case "$DATATYPE" in
16   ('')
17     echo >&2 I: No link data available for this task.
18     exec task "$TSK"
19     ;;
20
21   (msgid)
22     if command -v neomutt >/dev/null && command -v notmuch >/dev/null; then
23       exec neomutt -f "notmuch://$HOME/mail/?query=thread:{mid:$DATAPAYL}"
24
25     else
26       exec mutt -f =store -e "push '<limit>~(=i\"$DATAPAYL\")<enter><search>=i\"$DATAPAYL\"<enter>'"
27
28     fi
29     ;;
30
31   (url)
32     exec sensible-browser "$DATAPAYL"
33     ;;
34
35   (file)
36     if eval test -f "$DATAPAYL"; then
37       case "$(file --mime-type "$DATAPAYL")" in
38         (*": text/"*) eval exec sensible-editor "$DATAPAYL";;
39         (*) eval exec run-mailcap --action=view "$DATAPAYL";;
40       esac
41     fi
42     ;;
43
44   (*)
45     eval exec run-mailcap --action=view "$DATAPAYL"
46     ;;
47
48 esac