]> git.rmz.io Git - dotfiles.git/blobdiff - zsh/lib/50-taskwarrior.zsh
zsh: add `turg` function to get most urgent task
[dotfiles.git] / zsh / lib / 50-taskwarrior.zsh
index ce423cff03e21f842262561667c7f7b0e6246618..4e6c8487a6802616c581d82e14dbb1c5fc85da5e 100644 (file)
@@ -2,14 +2,18 @@ if (( ! $+commands[task] )); then
     return 1
 fi
 
-alias t="noglob task"
+alias task="noglob task"
+alias t="task"
 alias tt="task today"
-alias tlatest="t +LATEST"
-alias in="noglob task add +in"
+
+alias in="task add +in"
 alias inn="in rc.context=none"
+
 alias tw="task context wfh"
 alias th="task context home"
 
+alias tlatest="t +LATEST"
+
 autoload -Uz task-quote-magic
 zle -N self-insert task-quote-magic
 
@@ -18,6 +22,24 @@ function tparent() {
     task _get $1.rparent
 }
 
+function tick() {
+    # TODO: have duration as an option to allow multiple filter
+    if (( # < 1 || # > 2)); then
+        print >&2 "Usage: $0 <filter> [duration]"
+        return 1
+    fi
+    task $1 mod wait:${2:-1h}
+}
+
+function turg() {
+    local context=$(task _get rc.context)
+    local context_read=$(task _get rc.context.$context.read)
+    local urg_task=$(task +READY $context_read _urgency | sort -k4 -n | tail -1 | cut -d" " -f2)
+    task $urg_task $@
+}
+
+# TODO: function to show the latest report
+
 function task_today_list() {
   local task_cmd=(task rc.verbose:nothing)
   local task_count=$($task_cmd $($task_cmd _get rc.report.today.filter) count)