diff options
author | Daniel Schauenberg <d@unwiredcouch.com> | 2010-09-01 13:21:48 +0200 |
---|---|---|
committer | Daniel Schauenberg <d@unwiredcouch.com> | 2010-09-01 13:21:48 +0200 |
commit | cef6dcd98bb42c5ca2613bbbef12dd384ec8e33a (patch) | |
tree | f5667df18029576278ffe96aa5f341ca9493f2b0 | |
parent | a8ec607a9c175c96b2defc2cebc3a9830c07daf8 (diff) | |
parent | fe09064fcf4859b0e417c8040094f622f971012a (diff) | |
download | zsh-cef6dcd98bb42c5ca2613bbbef12dd384ec8e33a.tar.gz zsh-cef6dcd98bb42c5ca2613bbbef12dd384ec8e33a.tar.bz2 zsh-cef6dcd98bb42c5ca2613bbbef12dd384ec8e33a.zip |
Merge branch 'pip_plugin'
-rw-r--r-- | functions/pip/_pip | 46 | ||||
-rw-r--r-- | plugins/pip.plugin.zsh | 4 |
2 files changed, 50 insertions, 0 deletions
diff --git a/functions/pip/_pip b/functions/pip/_pip new file mode 100644 index 000000000..b58010173 --- /dev/null +++ b/functions/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 diff --git a/plugins/pip.plugin.zsh b/plugins/pip.plugin.zsh new file mode 100644 index 000000000..69e21f8d7 --- /dev/null +++ b/plugins/pip.plugin.zsh @@ -0,0 +1,4 @@ +# add brew completion function to path +fpath=($ZSH/functions/pip $fpath) +autoload -U compinit +compinit -i |