]> git.madduck.net Git - etc/taskwarrior.git/commitdiff

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 support for attaching/calling extdata
authormartin f. krafft <madduck@madduck.net>
Wed, 30 Jan 2019 23:32:06 +0000 (12:32 +1300)
committermartin f. krafft <madduck@madduck.net>
Thu, 31 Jan 2019 01:53:41 +0000 (14:53 +1300)
.bin/task_attach [new file with mode: 0755]
.bin/task_call [new file with mode: 0755]
.config/taskwarrior/rc
.gitignore.d/taskwarrior
.zsh/zshrc/parts.d/50-taskwarrior

diff --git a/.bin/task_attach b/.bin/task_attach
new file mode 100755 (executable)
index 0000000..efcbf4b
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh
+set -eu
+
+if [ $# != 2 ]; then
+  echo >&2 E: Need exactly two arguments.
+  return 1
+fi
+
+TSK="$1"
+LINK="$2"
+
+case "$LINK" in
+  (*@*|"<*>")
+    LINK="${LINK%>}"; LINK="%{LINK#<}"
+    echo >&2 I: "Adding MsgID <$LINK> to task $TSK"
+    task "$TSK" mod data:msgid:"$LINK"
+    ;;
+
+  (*://*)
+    echo >&2 I: "Adding URL $LINK to task $TSK"
+    task "$TSK" mod data:url:"$LINK"
+    ;;
+
+  (*)
+    if [ -f "$LINK" ]; then
+
+      LINK="$(readlink -e "$LINK")"
+
+      case "$LINK" in
+        ($HOME/*) LINK="~${LINK#$HOME}";;
+      esac
+      echo >&2 I: "Adding file $LINK to task $TSK"
+      task "$TSK" mod data:file:"$LINK"
+
+    else
+      echo >&2 E: "Don't know how to handle link data $LINK"
+      return 1
+
+    fi
+    ;;
+esac
diff --git a/.bin/task_call b/.bin/task_call
new file mode 100755 (executable)
index 0000000..9f43a67
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+set -eu
+
+if [ $# != 1 ]; then
+  echo >&2 E: Need exactly one argument.
+  return 1
+fi
+
+TSK="$1"
+
+DATA="$(task _get "$TSK".data)"
+DATATYPE="${DATA%%:*}"
+DATAPAYL="${DATA#*:}"
+
+case "$DATATYPE" in
+  ('')
+    echo >&2 I: No link data available for this task.
+    task "$TSK"
+    ;;
+
+  (msgid)
+    mutt -f =store -e "push '<search>~i $DATAPAYL'<enter>"
+    ;;
+
+  (url)
+    sensible-browser "$DATAPAYL"
+    ;;
+
+  (file)
+    if eval test -f "$DATAPAYL"; then
+      case "$(file --mime-type "$DATAPAYL")" in
+        (*": text/"*) eval sensible-editor "$DATAPAYL";;
+        (*) eval run-mailcap --action=edit "$DATAPAYL";;
+      esac
+    fi
+    ;;
+
+  (*)
+    eval run-mailcap --action=edit "$DATAPAYL"
+    ;;
+
+esac
index 174ed8511a72ac78c4a0e56035521d80c438af29..0d33a2223ffcd1a0429328817ddab3a0eeb0f29d 100644 (file)
@@ -8,3 +8,13 @@ include /usr/share/taskwarrior/holidays.de-DE.rc
 include /usr/share/taskwarrior/holidays.en-NZ.rc
 
 include ~/.config/taskwarrior/taskd-credentials.rc
 include /usr/share/taskwarrior/holidays.en-NZ.rc
 
 include ~/.config/taskwarrior/taskd-credentials.rc
+
+uda.data.type=string
+uda.data.label=Ext.data
+uda.data.indicator=→
+
+report.next.columns=id,data.indicator,start.age,entry.age,depends,priority,project,tags,recur,scheduled.countdown,due.relative,until.remaining,description,urgency
+report.next.labels=ID,X,Active,Age,Deps,P,Project,Tag,Recur,S,Due,Until,Description,Urg
+
+alias.call=execute task_call
+alias.attach=execute task_attach
index 9e0a8b6ea74b480335a6eb68953f6d7684ac07b2..821a0507b272ae55b29a0f1a9070000b7f038c2b 100644 (file)
@@ -1,4 +1,6 @@
 *
 *
+!/.bin/task_attach
+!/.bin/task_call
 !/.config/taskwarrior/.gitignore
 !/.config/taskwarrior/rc
 !/.crontab.d/taskwarrior
 !/.config/taskwarrior/.gitignore
 !/.config/taskwarrior/rc
 !/.crontab.d/taskwarrior
index 561493ac13a44dbcea91bb1f69c6cea374b0513f..9138c2b0d858b3589721864ff8c7d2f730226531 100644 (file)
@@ -12,6 +12,8 @@ if whence task >/dev/null; then
   alias t=task
   alias t\?='alias -rm t t[a-z]'
   alias ta='t add'
   alias t=task
   alias t\?='alias -rm t t[a-z]'
   alias ta='t add'
+  alias tc='t call'
+  alias th='t attach'
   alias tn='t next'
   alias tl='t all'
   alias ty='t sync'
   alias tn='t next'
   alias tl='t all'
   alias ty='t sync'