diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2009-01-17 11:57:28 +0100 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2009-01-17 11:57:28 +0100 |
commit | 0bd40035437b8b7d539518bc727e31fdd62e1033 (patch) | |
tree | 89b3a89cf25d0290e4cb88c97d9f46de0e36c711 | |
parent | ba50a1b2f749632687589b3a96ca819985819ecd (diff) |
_devtodo: Almost added children support
-rw-r--r-- | etc/completions/_devtodo | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/etc/completions/_devtodo b/etc/completions/_devtodo index 80b99f4..7795da6 100644 --- a/etc/completions/_devtodo +++ b/etc/completions/_devtodo @@ -81,15 +81,24 @@ for arg in ${(k)arg_pair}; { } function _todo_index () { - typeset i + typeset number text i entry last_entry depth last_depth=0 IFS=$'\n' typeset -a index desc for i in $*; do case $i in -u) todo_opts+=(--filter done) esac done - for i in $(todo $todo_opts --format display='%n '); do - index+=${i}:$(todo $todo_opts --format display='%t' $i) + for entry in $(todo $todo_opts -f +children --format display='%1>%i%n:%t\n'); do + number=${entry%%:*} + depth=$(( ${#number} - ${#${number// }} )) + # FIXME the subscripts operate on the string instead of the array + ((depth)) && entry=${(j:.:)${${(s:.:)${last_entry%%:*}#.}[1,$depth]}}.$entry + text=${entry#*:} + number=${${entry%%:*}// } + entry=$number:$text + index+=$entry + last_depth=$depth + last_entry=$entry done _describe -t items index index } |