summaryrefslogtreecommitdiff
path: root/plugins/pip/_pip
diff options
context:
space:
mode:
authorNanoTech <nanotech008@gmail.com>2010-10-19 15:39:27 -0600
committerNanoTech <nanotech008@gmail.com>2010-10-19 15:39:27 -0600
commit68f893cbe05e5a84adf7f26a0ed7492af6e03def (patch)
tree81b436518d3552f47a02f44963e84700627d1bec /plugins/pip/_pip
parent02c5fd5bdd0d37bb0e1cb19ad058154f5b7d96a7 (diff)
parentdc12853b0c3e5af9e42f44cb9efdf57d44d20711 (diff)
downloadzsh-68f893cbe05e5a84adf7f26a0ed7492af6e03def.tar.gz
zsh-68f893cbe05e5a84adf7f26a0ed7492af6e03def.tar.bz2
zsh-68f893cbe05e5a84adf7f26a0ed7492af6e03def.zip
Merge branch 'master' of git://github.com/robbyrussell/oh-my-zsh
Diffstat (limited to 'plugins/pip/_pip')
-rw-r--r--plugins/pip/_pip46
1 files changed, 46 insertions, 0 deletions
diff --git a/plugins/pip/_pip b/plugins/pip/_pip
new file mode 100644
index 000000000..b58010173
--- /dev/null
+++ b/plugins/pip/_pip
@@ -0,0 +1,46 @@
+#compdef pip
+#autoload
+
+# pip zsh completion, based on homebrew completion
+
+_pip_installed() {
+ installed_pkgs=(`pip freeze`)
+}
+
+local -a _1st_arguments
+_1st_arguments=(
+ 'bundle:Create pybundles (archives containing multiple packages)'
+ 'freeze:Output all currently installed packages (exact versions) to stdout'
+ 'help:Show available commands'
+ 'install:Install packages'
+ 'search:Search PyPI'
+ 'uninstall:Uninstall packages'
+ 'unzip:Unzip individual packages'
+ 'zip:Zip individual packages'
+)
+
+local expl
+local -a pkgs installed_pkgs
+
+_arguments \
+ '(--version)--version[Show version number of program and exit]' \
+ '(-v --verbose)'{-v,--verbose}'[Give more output]' \
+ '(-q --quiet)'{-q,--quiet}'[Give less output]' \
+ '(-h --help)'{-h,--help}'[Show help]' \
+ '*:: :->subcmds' && return 0
+
+if (( CURRENT == 1 )); then
+ _describe -t commands "pip subcommand" _1st_arguments
+ return
+fi
+
+case "$words[1]" in
+ list)
+ if [[ "$state" == forms ]]; then
+ _pip_installed
+ _requested installed_pkgs expl 'installed packages' compadd -a installed_pkgs
+ fi ;;
+ uninstall)
+ _pip_installed
+ _wanted installed_pkgs expl 'installed packages' compadd -a installed_pkgs ;;
+esac