-
Notifications
You must be signed in to change notification settings - Fork 0
/
_pip
100 lines (86 loc) · 2.95 KB
/
_pip
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
89
90
91
92
93
94
95
96
97
98
99
100
#compdef pip
local ret=1 state
declare -ga common_ops
common_ops=(
"--version[display version number]"
{-h,--help}"[show help]"
{-E,--environment=}"[virtualenv environment to run pip]:environment:_directories"
{-s,--enable-site-packages}"[include site-packages in virtualenv]"
{-v,--verbose}"[give more output]"
{-q,--quiet}"[give less output]"
"--log=[log file where a complete record will be kept]"
"--proxy=[specify a proxy in the form user:[email protected]:port]:proxy"
"--timeout=[set the socket timeout (default 15 seconds)]:second"
)
_directories () {
_wanted directories expl directory _path_files -/ "$@" -
}
typeset -A opt_args
_arguments \
':subcommand:->subcommand' \
$common_ops \
'*::options:->options' && ret=0
case $state in
subcommand)
subcommands=(
"bundle:create pybundle"
"freeze:put all currently installed packages"
"help:show available commands"
"install:install packages"
"search:search pypi"
"usinstall:uninstall packages"
"unzip:unzip undividual packages"
"zip:zip dividual packages"
)
_describe -t subcommands 'pip subcommand' subcommands && ret=0
;;
options)
declare -a args
args=(
$common_ops
)
declare -a requirement
requirement=(
{-r,--requirement=}"[install all the packages listed in the given requirements file]:filename"
)
declare -a findlink
findlink=(
{-f,--find-links=}"[URL to look for packages at]:url"
)
case $words[1] in
bundle | install)
args+=(
{-e,--editable=}"[install a package directly from a checkout]:VCS+REPOS_URL[@REV]#egg=PACKAGE"
$requirement
$findlink
{-i,--index-url=,--pypi-url=}"[base URL of Python Package Index]:URL"
"--extra-index-url=[extra URLs of package indexes to use]:URL"
{-b,--build=,--build-dir=}"[unpack packages into DIR]:directory:_directories"
{--src=,--source=}"[check out --editable packages into DIR]:directory:_directories"
{-U,--upgrade}"[upgrade all packages to the newest available version]"
{-I,--ignore-installed}"[ignore the installed packages]"
"--noinstall[download and unpack all packages, but don't actually install them]"
"--install-option=[extra arguments to be supplied to the setup.py install command]"
)
;;
freeze)
args+=(
$requirement
$findlink
)
;;
unzip | zip)
args+=(
"--unzip[unzip a package]"
"--no-pyc[do not include .pyc files in zip files]"
{-l,--list}"[list the packages available, and their zip status]"
"--sort-files[with --list, sort packages according to how many files they contain]"
"--path=[restrict operation to the given paths]:paths"
{-n,--simulate}"[do not actually perform the zip/unzip operation]"
)
;;
esac
_arguments $args && ret=0
;;
esac
return ret