summary refs log tree commit diff
path: root/Completion/Unix/Command
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r--Completion/Unix/Command/_texinfo22
1 files changed, 18 insertions, 4 deletions
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