root/lang/zsh/Completion/_gem @ 25487

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