root/lang/zsh/Completion/_gem @ 25489

Revision 25489, 1.3 kB (checked in by hogelog, 4 years ago)
  • format code.
Line 
1#compdef gem
2
3# gem 1.2.0
4
5typeset -A opt_args
6local context state line ret=1
7local -a cmds
8cmds=( 'build' 'cert' 'check' 'cleanup' 'contents' 'dependency' 'environment' 'fetch' 'generate_index' 'help' 'install' 'list' 'lock' 'mirror' 'outdated' 'pristine' 'query' 'rdoc' 'search' 'server' 'sources' 'specification' 'stale' 'uninstall' 'unpack' 'update' 'which' )
9
10_arguments \
11'(1 * -)'{-h,--help}'[print help message]' \
12'(1 * -)'{-v,--version}'[print the version]' \
13"(-)1: :->cmds" \
14'*: :->args' && ret=0
15
16case $state in
17  cmds)
18    _describe -t commands 'gem command' cmds && ret=0
19  ;;
20  args)
21    case $line[1] in
22      (fetch|install)
23        if ( [[ ${+_packages} -eq 0 ]] || _cache_invalid packages ) && ! _retrieve_cache packages; then
24          _packages=(${${(f)"$(_call_program packages gem list -r 2>/dev/null |sed '1,3d')"}/(#b)([^ ]##) # (*)/${match[1]}})
25          _store_cache packages _packages
26        fi
27
28        _wanted packages expl 'gem package' compadd $_packages && ret=0
29      ;;
30      (clean|uninstall|unpack)
31        local -a packages
32        packages=(${${(f)"$(_call_program packages gem list -l 2>/dev/null |sed '1,3d')"}/(#b)([^ ]##) # (*)/${match[1]}})
33        _wanted packages expl 'gem package' compadd $packages && ret=0
34      ;;
35    esac
36  ;;
37esac
38return ret
39# vim: ft=zsh sw=2 ts=2 et:
Note: See TracBrowser for help on using the browser.