summaryrefslogtreecommitdiff
path: root/plugins/pip
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pip')
-rw-r--r--plugins/pip/README.md19
-rw-r--r--plugins/pip/pip.plugin.zsh5
2 files changed, 22 insertions, 2 deletions
diff --git a/plugins/pip/README.md b/plugins/pip/README.md
new file mode 100644
index 000000000..f07b5c058
--- /dev/null
+++ b/plugins/pip/README.md
@@ -0,0 +1,19 @@
+# pip plugin
+
+This plugin adds completion for [pip](https://pip.pypa.io/en/latest/),
+the Python package manager.
+
+To use it, add `pip` to the plugins array in your zshrc file:
+
+```zsh
+plugins=(... pip)
+```
+
+## pip cache
+
+The pip plugin caches the names of available pip packages from the PyPI index.
+To trigger the caching process, try to complete `pip install`,
+or you can run `zsh-pip-cache-packages` directly.
+
+To reset the cache, run `zsh-pip-clear-cache` and it will be rebuilt next
+the next time you autocomplete `pip install`.
diff --git a/plugins/pip/pip.plugin.zsh b/plugins/pip/pip.plugin.zsh
index d7236b02a..aaae90185 100644
--- a/plugins/pip/pip.plugin.zsh
+++ b/plugins/pip/pip.plugin.zsh
@@ -10,7 +10,7 @@
# "zsh-pip-clear-cache".
ZSH_PIP_CACHE_FILE=~/.pip/zsh-cache
-ZSH_PIP_INDEXES=(https://pypi.python.org/simple/)
+ZSH_PIP_INDEXES=(https://pypi.org/simple/)
zsh-pip-clear-cache() {
rm $ZSH_PIP_CACHE_FILE
@@ -29,9 +29,10 @@ zsh-pip-cache-packages() {
if [[ ! -f $ZSH_PIP_CACHE_FILE ]]; then
echo -n "(...caching package index...)"
tmp_cache=/tmp/zsh_tmp_cache
+ touch $tmp_cache
for index in $ZSH_PIP_INDEXES ; do
# well... I've already got two problems
- curl $index 2>/dev/null | \
+ curl -L $index 2>/dev/null | \
zsh-pip-clean-packages \
>> $tmp_cache
done