diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2008-11-26 17:22:45 +0100 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2008-11-26 17:22:45 +0100 |
commit | e6ab3eeb6274298986c1d2677efed000fd846309 (patch) | |
tree | 47aa801cbd6bde9f5b7386be542a9113327e28c1 /etc | |
parent | 45ed9b4254551af182db75c1f7b28f5a44129b13 (diff) |
todo completion: Parse the commandline to get the database file
Now, items can be completed for custom databases (--database file) as well
Diffstat (limited to 'etc')
-rw-r--r-- | etc/completions/_devtodo | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/etc/completions/_devtodo b/etc/completions/_devtodo index 7eb87b0..b3652a1 100644 --- a/etc/completions/_devtodo +++ b/etc/completions/_devtodo @@ -3,10 +3,17 @@ ## Daniel Friesel <derf@derf.homelinux.org> ## https://derf.homelinux.org/~derf/dotfiles/completion/_devtodo -typeset -a arg_generic arg_add +typeset -a arg_generic arg_add todo_opts typeset -A arg_pair arg_desc +typeset -i i typeset expl +for ((i=2; i <= $#words; i++)) { + if [[ $words[$i] == '--database' ]] { + todo_opts+=(--database ${~words[$((++i))]}) + } +} + arg_add=( '-p[priority]:priority:_priority' '-g[parent item]:parent:_index' @@ -72,14 +79,14 @@ for arg in ${(k)arg_pair}; { function _index () { typeset i - typeset -a index desc tdoptions + typeset -a index desc for i in $*; do case $i in - -u) tdoptions=(--filter done) + -u) todo_opts+=(--filter done) esac done - for i in $(todo $tdoptions --format display='%n '); do - index+=${i}:$(todo $tdoptions --format display='%t' $i) + for i in $(todo $todo_opts --format display='%n '); do + index+=${i}:$(todo $todo_opts --format display='%t' $i) done _describe -t items index index } |