1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-09-28 15:01:21 +02:00

users/9483: completion for ri (ruby documentation viewer)

This commit is contained in:
Clint Adams 2006-11-01 02:58:07 +00:00
parent 006229c32e
commit a7ba87f316
2 changed files with 29 additions and 0 deletions

@ -1,3 +1,8 @@
2006-11-01 Clint Adams <clint@zsh.org>
* users/9483: Sir Raorn(?): Completion/Unix/Command/_ri:
completion for ri (ruby documentation viewer).
2006-10-27 Peter Stephenson <pws@csr.com>
* 22924: Src/Zle/complist.c, Src/Zle/compresult.c,

@ -0,0 +1,24 @@
#compdef ri
local curcontext="$curcontext" state line ret=1
typeset -A opt_args
_arguments \
'(- *)'{-h,--help}'[print help information and exit]' \
'(- *)'{-v,--version}'[display the version of ri]' \
'(-c --classes)'{-c,--classes}'[display the names of classes and modules we know about]' \
'(-d --doc-dir)'{-d,--doc-dir}'[directory to search for documentation]:ri doc directory:_files -/' \
'(-f --format)'{-f,--format}'[format to use when displaying output]:output format:(ansi bs html plain simple)' \
'(-l --list-names)'{-l,--list-names}'[list all the names known to RDoc]' \
'(-T --no-pager)'{-T,--no-pager}'[send output directly to stdout]' \
'(-w --width)'{-w,--width}'[set the width of the output]:output width:' \
'*:ri name:->ri-name' && ret=0
if [[ "$state" = ri-name ]]; then
local ri_names expl
ri_names=( ${(f)"$( _call_program ri-names "$words[1]" ${(v)opt_args[(I)(-d|--doc-dir)]:+-d "${(v)opt_args[(I)(-d|--doc-dir)]}"} -l -T )"} )
_wanted ri-names expl "ri name" compadd -a ri_names && ret=0
fi
return $ret