1 #compdef pip pip2 pip-2.7 pip3 pip-3.2 pip-3.3 pip-3.4
4 # pip zsh completion, based on last stable release (pip8)
5 # homebrew completion and backwards compatibility
8 # we cache the list of packages (originally from the macports plugin)
9 if (( ! $+piplist )); then
10 zsh-pip-cache-packages
11 piplist=($(cat $ZSH_PIP_CACHE_FILE))
16 installed_pkgs=($($service freeze | cut -d '=' -f 1))
19 local -a _1st_arguments
21 'install:install packages'
22 'download:download packages'
23 'uninstall:uninstall packages'
24 'freeze:output all currently installed packages (exact versions) to stdout'
25 'list:list installed packages'
26 'show:show information about installed packages'
28 'wheel:build individual wheel archives for your requirements and dependencies'
29 'hash:compute a hash of a local package archive'
30 'help:show available commands'
31 'bundle:create pybundles (archives containing multiple packages)(deprecated)'
32 'unzip:unzip individual packages(deprecated)'
33 'zip:zip individual packages(deprecated)'
37 local -a all_pkgs installed_pkgs
40 '(-h --help)'{-h,--help}'[show help]' \
41 '(--isolated)--isolated[run pip in isolated mode, ignores environment variables and user configuration]' \
42 '(-v --verbose)'{-v,--verbose}'[give more output]' \
43 '(-V --version)'{-V,--version}'[show version number of program and exit]' \
44 '(-q --quiet)'{-q,--quiet}'[give less output]' \
45 '(--log)--log[log file location]' \
46 '(--proxy)--proxy[proxy in form user:passwd@proxy.server:port]' \
47 '(--retries)--retries[max number of retries per connection (default 5 times)]' \
48 '(--timeout)--timeout[socket timeout (default 15s)]' \
49 '(--exists-action)--exists-action[default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup]' \
50 '(--trusted-host)--trusted-host[mark this host as trusted]' \
51 '(--cert)--cert[path to alternate CA bundle]' \
52 '(--client-cert)--client-cert[path to SSL client certificate]' \
53 '(--cache-dir)--cache-dir[store the cache data in specified directory]' \
54 '(--no-cache-dir)--no-cache-dir[disable de cache]' \
55 '(--disable-pip-version-check)--disable-pip-version-check[do not check periodically for new pip version downloads]' \
56 '(-E --environment)'{-E,--environment}'[virtualenv environment to run pip in (deprecated)]' \
57 '(-s --enable-site-packages)'{-s,--enable-site-packages}'[include site-packages in virtualenv (deprecated)]' \
58 '*:: :->subcmds' && return 0
60 if (( CURRENT == 1 )); then
61 _describe -t commands "pip subcommand" _1st_arguments
68 '(--index)--index[base URL of Python Package Index]' ;;
71 '(-l --local)'{-l,--local}'[report only virtualenv packages]' ;;
74 '(-U --upgrade)'{-U,--upgrade}'[upgrade all packages to the newest available version]' \
75 '(--user)--user[install packages to user home]' \
76 '(-f --find-links)'{-f,--find-links}'[URL for finding packages]' \
77 '(-r --requirement)'{-r,--requirement}'[Requirements file for packages to install]:File:_files' \
78 '(--no-deps --no-dependencies)'{--no-deps,--no-dependencies}'[iIgnore package dependencies]' \
79 '(--no-install)--no-install[only download packages]' \
80 '(--no-download)--no-download[only install downloaded packages]' \
81 '(--install-option)--install-option[extra arguments to be supplied to the setup.py]' \
82 '(--single-version-externally-managed)--single-version-externally-managed[do not download/install dependencies. requires --record or --root]'\
83 '(--root)--root[treat this path as a fake chroot, installing into it. implies --single-version-externally-managed]'\
84 '(--record)--record[file to record all installed files to.]'\
85 '(-r --requirement)'{-r,--requirement}'[requirements file]: :_files'\
86 '(-e --editable)'{-e,--editable}'[path of or url to source to link to instead of installing.]: :_files -/'\
87 '1: :->packages' && return 0
89 if [[ "$state" == packages ]]; then
91 _wanted piplist expl 'packages' compadd -a piplist
92 _files -g "*.(tar.gz|whl)"
96 _wanted installed_pkgs expl 'installed packages' compadd -a installed_pkgs ;;
99 _wanted installed_pkgs expl 'installed packages' compadd -a installed_pkgs ;;