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

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:

Add '.config/taskwarrior/taskpirate/' from commit 'c0d91dae27c2a1f73ed9fc103f7fbfcfc3...
[etc/taskwarrior.git] / .bin / task_attach
1 #!/bin/sh
2 set -eu
3
4 if [ $# != 2 ]; then
5   echo >&2 E: Need exactly two arguments.
6   return 1
7 fi
8
9 TSK="$1"
10 LINK="$2"
11
12 case "$LINK" in
13   (*@*|"<*>")
14     LINK="${LINK%>}"; LINK="%{LINK#<}"
15     echo >&2 I: "Adding MsgID <$LINK> to task $TSK"
16     task "$TSK" mod data:msgid:"$LINK"
17     ;;
18
19   (*://*)
20     echo >&2 I: "Adding URL $LINK to task $TSK"
21     task "$TSK" mod data:url:"$LINK"
22     ;;
23
24   (*)
25     if [ -f "$LINK" ]; then
26
27       LINK="$(readlink -e "$LINK")"
28
29       case "$LINK" in
30         ($HOME/*) LINK="~${LINK#$HOME}";;
31       esac
32       echo >&2 I: "Adding file $LINK to task $TSK"
33       task "$TSK" mod data:file:"$LINK"
34
35     else
36       echo >&2 E: "Don't know how to handle link data $LINK"
37       return 1
38
39     fi
40     ;;
41 esac