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/.distfiles2
-rw-r--r--Completion/Unix/Command/_texinfo53
2 files changed, 54 insertions, 1 deletions
diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles
index 5d340e50b..fe86ae1b2 100644
--- a/Completion/Unix/Command/.distfiles
+++ b/Completion/Unix/Command/.distfiles
@@ -17,5 +17,5 @@ _diff         _gs           _make         _psutils      _tin	_apm  _mail
 _last         _loadkeys     _modutils     _ruby         _sysctl _links _samba
 _user_admin   _rsync        _arping	  _spamassassin _mtools       _ifconfig
 _fsh          _chkconfig    _cdcd         _irssi        _mysqldiff    _sccs
-_netcat       _larch        _valgrind
+_netcat       _larch        _valgrind     _texinfo
 '
diff --git a/Completion/Unix/Command/_texinfo b/Completion/Unix/Command/_texinfo
new file mode 100644
index 000000000..cc07435ad
--- /dev/null
+++ b/Completion/Unix/Command/_texinfo
@@ -0,0 +1,53 @@
+#compdef info
+
+_info () {
+  local context state line expl ret=1
+  typeset -A opt_args
+  local -a info
+
+  info=(_call_program info ${words[1]})
+
+  _arguments -s \
+    '(: -)--apropos=[look up string in indices]:search string: ' \
+    '(-f --file)'{\*-d,\*--directory=}'[add directory to infopath]:info dir:_files -/' \
+    '--dribble=[record keystrokes]:file with keystrokes:_files' \
+    '(-f --file -d --directory)'{-f,--file=}'[info file to show]:info file:_files -g "*.info(|.gz|.bz2)"' \
+    '(: - -h --help)'{-h,--help}'[display usage]' \
+    '(-o --output -O)--index-search=[go directly to node if found]:search string: ' \
+    '(--index-search -o --output -O)'{-o,--output=}'[dump selected nodes to filename]:filename:_files -g "*(^/)"' \
+    '(-R --raw-escapes)'{-R,--raw-escapes}'[do not remove ANSI escapes from man pages]' \
+    '--restore=[read keystrokes from file]:filename:_files -g "*(^/)"' \
+    '(--index-search -o --output -O --show-options --usage)'{-O,--show-options,--usage}'[go to command-line options node]' \
+    '--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
+
+  case $state in
+    item )
+      local -a items
+
+      info=($info ${(kv)opt_args[(I)(-d|--directory|-f|--file)]})
+
+      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
+    ;;
+  esac
+
+  return $ret
+}
+
+_texinfo () {
+  local ret=1
+
+  case $service in
+    info )
+      _info && ret=0
+    ;;
+  esac
+
+  return $ret
+}
+
+_texinfo "$@"