-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path_perlbrew
50 lines (45 loc) · 1.74 KB
/
_perlbrew
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#compdef perlbrew
typeset -A opt_args
local context state line
_arguments -C \
'(- 1 *)'{-h,--help}'[prints this help]' \
'(-f --force)'{-f,--force}'[Force installation of a perl]' \
'(-j)-j=-:[Enable parallel make and test (if supported by the target perl)]' \
'(-q --quiet)'{-q,--quiet}'[Log output to a log file rather than STDOUT. This is the default.]' \
'(-v --verbose)'{-v,--verbose}'[Log output to STDOUT rather than a logfile]' \
'*-D=-:[pass through switches to the perl Configure script]' \
'*-U=-:[pass through switches to the perl Configure script]' \
'*-A=-:[pass through switches to the perl Configure script]' \
'(-as)'-as+'[Install a given perl under an alias.]:alias name' \
'1: :->cmds' \
'(1 *): :->args' && return 0
case $state in
cmds)
local -a cmds
cmds=( init install uninstall switch switch-off list use available off help mirror version install-cpanm self-upgrade env )
_describe -t commands 'perlbrew command' cmds && ret=0
;;
args)
case $line[1] in
switch | use)
local -a versions
versions=($(ls $PERLBREW_ROOT/perls/ | perl -pe 's/$ENV{PERLBREW_PERL}//;s/\n/ /m'))
_wanted versions expl 'perl version' compadd $versions && ret=0
;;
install)
local -a perl_versions
perl_versions=($(perlbrew available|perl -pe 's/^i//m;s/\n/ /m') perl-blead )
_wanted perl_versions expl 'perl-<version-number>' compadd $perl_versions && ret=0
;;
uninstall)
local -a versions
versions=($(ls $PERLBREW_ROOT/perls/ | perl -pe 's/\n/ /m'))
_wanted versions expl 'perl version' compadd $versions && ret=0
;;
*)
(( ret )) && _message 'no more arguments'
;;
esac
;;
esac
return ret