From cab118d4d10d2cef336fdc9548c0cee129cf77d1 Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov Date: Sat, 7 Oct 2006 12:51:02 +0000 Subject: 22839: complete filenames as first argument to info too --- Completion/Unix/Command/_texinfo | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'Completion/Unix/Command/_texinfo') diff --git a/Completion/Unix/Command/_texinfo b/Completion/Unix/Command/_texinfo index 13a5944f0..405de2629 100644 --- a/Completion/Unix/Command/_texinfo +++ b/Completion/Unix/Command/_texinfo @@ -21,7 +21,7 @@ case $service in '--subnodes[recursively output menu items]' \ '--vi-keys[use Vi-like key bindings]' \ '(: -)--version[display version information]' \ - '(--apropos -h --help -O --output --version)*::menu items:->item' && ret=0 + '(--apropos -h --help -O --output --version)*::menu item:->item' && ret=0 info=( $info {(kv)opt_args[(I)(-d|--directory|-f|--file)]} ) ;; @@ -146,11 +146,25 @@ esac case $state in item ) - local -a items + local -a items tags expl infopath + (( $#INFOPATH )) && infopath=( -W ${s/:/INFOPATH} ) - items=(${${(M)${${(f)"$(${info} --output - ${words[1,CURRENT-1]} 2>/dev/null)"}[1,(r)[[:space:]]#--- The Detailed Node Listing ---[[:space:]]#]}:#\* *~\* Menu:*}:/(#b)\*[[:space:]]##([^:]##):(#B)( \(?##\)[^.]#.|(:|))[[:space:]]#(#b)(*)[[:space:]]#/$match[1]${match[2]:+:}$match[2]}) + tags=(items) + if [[ $CURRENT -eq 1 ]]; then + tags+=files + fi + + _tags $tags + while _tags; do + if _requested files expl 'info file'; then + _files "$expl[@]" $infopath -g '*.info' && ret=0 + fi + if _requested items; then + items=(${${(M)${${(f)"$(${info} --output - ${words[1,CURRENT-1]} 2>/dev/null)"}[1,(r)[[:space:]]#--- The Detailed Node Listing ---[[:space:]]#]}:#\* *~\* Menu:*}:/(#b)\*[[:space:]]##([^:]##):(#B)( \(?##\)[^.]#.|(:|))[[:space:]]#(#b)(*)[[:space:]]#/$match[1]${match[2]:+:}$match[2]}) - _describe -t items "menu items" items && ret=0 + _describe -t items "menu item" items && ret=0 + fi + done ;; esac -- cgit 1.4.1