1c4997f5cada6f1ff1f205b20cf321cfc6b6d347
- Author
- Max Persson <max@maxpersson.com>
- Committer
- Max Persson <max@maxpersson.com>
- Date
Message
Added caching of packages
Diff
1diff --git a/plugins/pip/_pip b/plugins/pip/_pip
2index 8c03d85192ee9932006aa78b440ed9a34ad2eea2..07d37c80e547083e401381ad3159fdbceb0ffdbf 100644
3--- a/plugins/pip/_pip
4+++ b/plugins/pip/_pip
5@@ -4,7 +4,10 @@
6 # pip zsh completion, based on homebrew completion
7
8 _pip_all() {
9- all_pkgs=(`pip search * | cut -d ' ' -f 1 | tr '[A-Z]' '[a-z]'`)
10+ # we cache the list of packages (originally from the macports plugin)
11+ if (( ! $+piplist )); then
12+ piplist=($(pip search * | cut -d ' ' -f 1 | tr '[A-Z]' '[a-z]'))
13+ fi
14 }
15
16 _pip_installed() {
17@@ -62,7 +65,7 @@ case "$words[1]" in
18
19 if [[ "$state" == packages ]]; then
20 _pip_all
21- _wanted all_pkgs expl 'packages' compadd -a all_pkgs
22+ _wanted piplist expl 'packages' compadd -a piplist
23 fi ;;
24 uninstall)
25 _pip_installed