summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <p.stephenson@samsung.com>2022-03-24 10:37:39 +0000
committerPeter Stephenson <p.stephenson@samsung.com>2022-03-24 10:37:39 +0000
commit57305cf245853b8b30895b41a90142dffab97e38 (patch)
tree559d51e8eee8e8153b7185b92346e421c78bcb02
parent587793f818be06ad10d31e6692982c1783ed49fd (diff)
downloadzsh-57305cf245853b8b30895b41a90142dffab97e38.tar.gz
zsh-57305cf245853b8b30895b41a90142dffab97e38.tar.xz
zsh-57305cf245853b8b30895b41a90142dffab97e38.zip
49875: completion for info -f.
Use local files if there's a slash in the argument.
-rw-r--r--ChangeLog4
-rw-r--r--Completion/Unix/Command/_texinfo9
2 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 4f82451e5..21d68de57 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2022-03-24  Peter Stephenson  <p.stephenson@samsung.com>
 
+	* 49875: Completion/Unix/Command/_texinfo: info -f completes
+	both info pages by search and (if there's a slash present) local
+	files.  Not all versions of info seem to need the slash, however.
+
 	* 49845: Doc/Zsh/options.yo: clarify that options can be local
 	in function scope.
 
diff --git a/Completion/Unix/Command/_texinfo b/Completion/Unix/Command/_texinfo
index 7dfa32e45..2f5d0f91f 100644
--- a/Completion/Unix/Command/_texinfo
+++ b/Completion/Unix/Command/_texinfo
@@ -41,7 +41,7 @@ case $service in
       '(: -)'{-k+,--apropos=}'[look up string in indices]:search string: ' \
       \*{-d+,--directory=}'[add directory to infopath]:info dir:_files -/' \
       '--dribble=[record keystrokes]:file with keystrokes:_files' \
-      '(-f --file 1)'{-f+,--file=}'[specify Info manual to visit]:info manual:->infofiles' \
+      '(-f --file 1)'{-f+,--file=}'[specify Info manual to visit]:info manual:->infofiles+' \
       '(: - -h --help)'{-h,--help}'[display usage]' \
       '(-o --output -O)--index-search=[search for matching index entry]:search string:->index-entries' \
       '(--index-search -o --output -O)'{-o+,--output=}'[dump selected nodes to filename]:filename:_files -g "*(-.)"' \
@@ -289,7 +289,11 @@ if [[ -n $state ]]; then
     items=( ${${${(M)${(f)"$(_call_program menu-items info -o-)"}:#(#s)\* *: \(*}#??}%%\)*} )
     files+=( ${items##*\(} )
     tags=( info-files )
-    if [[ $state != infofiles ]]; then
+    if [[ $state = infofiles+ && $PREFIX$SUFFX = */* ]]; then
+      # local files allowed
+      tags+=(files)
+    fi
+    if [[ $state != infofiles* ]]; then
       tags+=( menu-items )
       items=( ${items%:*} )
     fi
@@ -317,6 +321,7 @@ if [[ -n $state ]]; then
     _requested menu-items expl 'menu item' compadd -M 'm:{a-zA-Z}={A-Za-z}' -a items && ret=0
     _requested -x index-entries expl 'index entry' compadd -M 'm:{a-zA-Z}={A-Za-z}' -a items && ret=0
     _requested info-nodes expl 'node' compadd -M 'm:{a-zA-Z}={A-Za-z}' ${nodes#*:} && ret=0
+    _requested files expl 'file' && _files -g '*.info(|.gz|.bz2)'
 
     (( ret )) || break
   done