about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrey Borzenkov <bor@users.sourceforge.net>2006-10-07 12:51:02 +0000
committerAndrey Borzenkov <bor@users.sourceforge.net>2006-10-07 12:51:02 +0000
commitcab118d4d10d2cef336fdc9548c0cee129cf77d1 (patch)
tree5403908d756fd9ea7376f23ebc9a0cd59b1e1423
parent52f132de62fd4dbef49dc31344d8f430d3f80cb8 (diff)
downloadzsh-cab118d4d10d2cef336fdc9548c0cee129cf77d1.tar.gz
zsh-cab118d4d10d2cef336fdc9548c0cee129cf77d1.tar.xz
zsh-cab118d4d10d2cef336fdc9548c0cee129cf77d1.zip
22839: complete filenames as first argument to info too
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Unix/Command/_texinfo22
2 files changed, 21 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 4a3108998..0f27ac0a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,9 @@
 	make CM_SPACE definition global and use it consistently in
 	compresults and compdescribe to lay out matches
 
+	* 22839: Completion/Unix/Command/_texinfo: as pointed by
+	Vincent Lefevre, info accepts file names as first argument
+
 2006-10-06  Peter Stephenson  <pws@csr.com>
 
 	* 10791: Src/Zle/compresult.c: accumulated completions
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