#compdef ri # # zsh completion for the ri ruby documentation tool # from http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-talk/128677 # + some changes _ri () { _arguments -C -s \ '(-h --help)'{-h,--help}'[print help message]' \ '(-c --classes)'{-c,--classes}'[Display the names of classes and modules we know about]' \ '(-d --doc-dir)'{-d+,--doc-dir+}'[A directory to search for documentation]:directory:_files -/' \ '(-f --format)'{-f,--format}'[Format to use when displaying output]:format:(ansi bs html plain simple)' \ '(-l --list-names)'{-l,--list-names}'[List all the names known to RDoc, one per line]' \ '(-T --no-pager)'{-T,--no-pager}'[Send output directly to stdout]' \ '(-w --width)'{-w+,--width+}'[output width]:width: ' \ '(-v --version)'{-v,--version}'[Display the version of ri]' \ "*:help topics:_ri_names" } _ri_names () { if ( [[ ${+_ri_list_names} -eq 0 ]] || _cache_invalid ri_names ) && ! _retrieve_cache ri_names; then _ri_list_names=( ${$(_call_program ri--list-names RI= ri -l -T 2>/dev/null)//\#/.} ) _store_cache ri_names _ri_list_names fi _multi_parts -i "." _ri_list_names } _ri "$@"