728
|
1 |
# -*- mode: sh; sh-shell-file: bash -*-
|
|
2 |
|
|
3 |
_pip()
|
|
4 |
{
|
|
5 |
local _cmds='install uninstall freeze list show search wheel help'
|
|
6 |
local _acts='switch ignore wipe backup'
|
|
7 |
local _opts='-h --help -v --verbose -V --version -q --quiet --proxy --timeout'
|
|
8 |
local _index_opts='-i --index-url --extra-index-url --no-index -f --find-links --allow-external --allow-all-external --allow-unverified --process-dependency-links'
|
|
9 |
local _install_opts='-e --editable -U --upgrade --force-reinstall -I --ignore-installed --no-deps --no-install --no-download \
|
|
10 |
--install-option --user --egg --compile --no-compile --no-use-wheel --pre --no-clean \
|
|
11 |
-e --editable -b --build -t --target -d --download --download-cache \
|
|
12 |
-r --requirement'
|
|
13 |
local _uninstall_opts='-y --yes -r --requirement'
|
|
14 |
local _list_opts='-o --outdated -u --uptodate -e --editable -l --local --pre'
|
|
15 |
local _freeze_opts='-f --find-links -l --local'
|
|
16 |
local _search_opts='--index'
|
|
17 |
local _show_opts='--index'
|
|
18 |
local _wheel_opts='--no-use-wheel --build-option --no-deps --global-option --pre --no-clean \
|
|
19 |
-w --wheel-dir --download-cache -b --build
|
|
20 |
-r, --requirement'
|
|
21 |
local cur
|
|
22 |
cur=${COMP_WORDS[COMP_CWORD]}
|
|
23 |
if [[ $COMP_CWORD = 1 ]]; then
|
|
24 |
COMPREPLY=( $(compgen -W '$_cmds' -- "$cur") )
|
|
25 |
return 0
|
|
26 |
fi
|
|
27 |
local first prev
|
|
28 |
first=${COMP_WORDS[1]}
|
|
29 |
prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
30 |
case "$prev" in
|
|
31 |
--cert|--log|--log-file)
|
|
32 |
COMPREPLY=( $(compgen -d -- "$cur") )
|
|
33 |
return 0 ;;
|
|
34 |
--exists-action)
|
|
35 |
COMPREPLY=( $(compgen -W '$_acts' -- "$cur") )
|
|
36 |
return 0 ;;
|
|
37 |
esac
|
|
38 |
case $first in
|
|
39 |
install)
|
|
40 |
case $prev in
|
|
41 |
-e|--editable|-b|--build|-t|--target|-d|--download|--download-cache)
|
|
42 |
COMPREPLY=( $(compgen -d -- "$cur") )
|
|
43 |
return 0 ;;
|
|
44 |
-r|--requirement)
|
|
45 |
COMPREPLY=( $(compgen -f -- "$cur") )
|
|
46 |
return 0 ;;
|
|
47 |
esac
|
|
48 |
COMPREPLY=( $(compgen -W '$_install_opts $_opts $_index_opts' -- "$cur") )
|
|
49 |
return 0 ;;
|
|
50 |
uninstall)
|
|
51 |
case $prev in
|
|
52 |
-r|--requirement)
|
|
53 |
COMPREPLY=( $(compgen -f -- "$cur") )
|
|
54 |
return 0 ;;
|
|
55 |
esac
|
|
56 |
COMPREPLY=( $(compgen -W '$_uninstall_opts $_opts' -- "$cur") )
|
|
57 |
return 0 ;;
|
|
58 |
list)
|
|
59 |
COMPREPLY=( $(compgen -W '$_list_opts $_opts $_index_opts' -- "$cur") )
|
|
60 |
return 0 ;;
|
|
61 |
freeze)
|
|
62 |
case $prev in
|
|
63 |
-r|--requirement)
|
|
64 |
COMPREPLY=( $(compgen -f -- "$cur") )
|
|
65 |
return 0 ;;
|
|
66 |
esac
|
|
67 |
COMPREPLY=( $(compgen -W '$_freeze_opts $_opts' -- "$cur") )
|
|
68 |
return 0 ;;
|
|
69 |
search)
|
|
70 |
COMPREPLY=( $(compgen -W '$_search_opts $_opts' -- "$cur") )
|
|
71 |
return 0 ;;
|
|
72 |
show)
|
|
73 |
COMPREPLY=( $(compgen -W '$_show_opts $_opts' -- "$cur") )
|
|
74 |
return 0 ;;
|
|
75 |
wheel)
|
|
76 |
case $prev in
|
|
77 |
-w|--wheel-dir|--download-cache|-b|--build)
|
|
78 |
COMPREPLY=( $(compgen -d -- "$cur") )
|
|
79 |
return 0 ;;
|
|
80 |
-r|--requirement)
|
|
81 |
COMPREPLY=( $(compgen -f -- "$cur") )
|
|
82 |
return 0 ;;
|
|
83 |
esac
|
|
84 |
COMPREPLY=( $(compgen -W '$_wheel_opts $_opts $_index_opts' -- "$cur") )
|
|
85 |
return 0 ;;
|
|
86 |
esac
|
|
87 |
COMPREPLY=( $(compgen -W '$_opts' -- "$cur") )
|
|
88 |
return 0
|
|
89 |
} &&
|
|
90 |
complete -F _pip pip pip2 pip2.5 pip2.6 pip2.7 pip2.8
|
|
91 |
|