-
Notifications
You must be signed in to change notification settings - Fork 1
/
_znvm
40 lines (35 loc) · 984 Bytes
/
_znvm
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
#compdef znvm
#autoload
local -a _1st_arguments
_1st_arguments=(
'ls:list installed versions'
'deactivate:remove nodejs from path'
'activate:add default nodejs to path'
'use:VERSION - change active nodejs to VERSION'
'install:VERSION - download and install nodejs VERSION'
'which:VERSION - print which version matches to VERSION'
'current:print currently active version'
'alias:NAME VERSION - create VERSION alias to NAME'
'hookpwchange:read automatically .nvmrc when changing directory'
)
_znvm_submcommand() {
case "$words[2]" in
'use'|'which')
_alternative "versions:installed versions:_znvm_installed_versions"
;;
'alias')
if (( CURRENT == 4 ));then
_alternative "versions:installed versions:_znvm_installed_versions"
fi
;;
'install')
_alternative "remote_versions:remote versions:_znvm_remote_versions"
;;
esac
return 1
}
if (( CURRENT == 2 ));then
_describe -t commands "znvm command" _1st_arguments
return
fi
_znvm_submcommand