-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathpyenv.sh
88 lines (74 loc) · 2.08 KB
/
pyenv.sh
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
_patch_help() {
_common_edit() {
sed \
-e '/^\s*-/ s|/-|, -|' \
-e '/--version/ d' \
-e 's/Usage: eval "$(\(.*\))"$/Usage: \1/' \
}
_patch_help_run_help $@ | _common_edit
}
_patch_table() {
if [[ "$*" == "pyenv exec" ]]; then
_patch_table_edit_arguments \
';;' \
'command;[`_choice_command`]' \
'args;~[`_module_os_command_args`]' \
elif [[ "$*" == "pyenv global" ]] \
|| [[ "$*" == "pyenv local" ]] \
|| [[ "$*" == "pyenv prefix" ]] \
|| [[ "$*" == "pyenv shell" ]] \
|| [[ "$*" == "pyenv uninstall" ]] \
; then
_patch_table_edit_arguments \
';;' \
'version;*[`_choice_installed_version`]' \
elif [[ "$*" == "pyenv hooks" ]]; then
_patch_table_edit_arguments \
'command;[`_choice_command`]' \
elif [[ "$*" == "pyenv init" ]]; then
_patch_table_edit_options \
'' ';;' \
'--path(<path>)' \
'--no-push-path' \
'--detect-shell' \
'--no-rehash' \
| \
_patch_table_edit_arguments \
'shell;[bash|fish|zsh]' \
elif [[ "$*" == "pyenv install" ]]; then
_patch_table_edit_options \
'--keep(<path>)' \
| \
_patch_table_edit_arguments \
'version;[`_choice_install`]' \
elif [[ "$*" == "pyenv latest" ]]; then
_patch_table_edit_arguments \
'prefix;[`_choice_prefix`]' \
elif [[ "$*" == "pyenv whence" ]] \
|| [[ "$*" == "pyenv which" ]] \
; then
_patch_table_edit_arguments \
'command;[`_module_os_command`]' \
else
cat
fi
}
_choice_command() {
pyenv exec --complete
}
_choice_installed_version() {
pyenv versions --bare
}
_choice_install() {
if _argc_util_has_path_prefix; then
_argc_util_comp_path
return
fi
_choice_available_version
}
_choice_prefix() {
pyenv prefix --complete
}
_choice_available_version() {
pyenv install --list | sed '1d'
}