4 # pip zsh completion, based on homebrew completion
7 # we cache the list of packages (originally from the macports plugin)
8 if (( ! $+piplist )); then
9 echo -n " (caching package index...)"
10 piplist=($(pip search * | cut -d ' ' -f 1 | tr '[A-Z]' '[a-z]'))
15 installed_pkgs=(`pip freeze | cut -d '=' -f 1`)
18 local -a _1st_arguments
20 'bundle:create pybundles (archives containing multiple packages)'
21 'freeze:output all currently installed packages (exact versions) to stdout'
22 'help:show available commands'
23 'install:install packages'
25 'uninstall:uninstall packages'
26 'unzip:unzip individual packages'
27 'zip:zip individual packages'
31 local -a all_pkgs installed_pkgs
34 '(--version)--version[show version number of program and exit]' \
35 '(-h --help)'{-h,--help}'[show help]' \
36 '(-E --environment)'{-E,--environment}'[virtualenv environment to run pip in]' \
37 '(-s --enable-site-packages)'{-s,--enable-site-packages}'[include site-packages in virtualenv]' \
38 '(-v --verbose)'{-v,--verbose}'[give more output]' \
39 '(-q --quiet)'{-q,--quiet}'[give less output]' \
40 '(--log)--log[log file location]' \
41 '(--proxy)--proxy[proxy in form user:passwd@proxy.server:port]' \
42 '(--timeout)--timeout[socket timeout (default 15s)]' \
43 '*:: :->subcmds' && return 0
45 if (( CURRENT == 1 )); then
46 _describe -t commands "pip subcommand" _1st_arguments
53 '(--index)--index[base URL of Python Package Index]' ;;
56 '(-l --local)'{-l,--local}'[report only virtualenv packages]' ;;
59 '(-U --upgrade)'{-U,--upgrade}'[upgrade all packages to the newest available version]' \
60 '(-f --find-links)'{-f,--find-links}'[URL for finding packages]' \
61 '(--no-deps --no-dependencies)'{--no-deps,--no-dependencies}'[iIgnore package dependencies]' \
62 '(--no-install)--no-install[only download packages]' \
63 '(--no-download)--no-download[only install downloaded packages]' \
64 '(--install-option)--install-option[extra arguments to be supplied to the setup.py]' \
65 '1: :->packages' && return 0
67 if [[ "$state" == packages ]]; then
69 _wanted piplist expl 'packages' compadd -a piplist
73 _wanted installed_pkgs expl 'installed packages' compadd -a installed_pkgs ;;