823be4ef5ff6753a9c5918218801709b98e5312f

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

feat(pyenv): silence bad config warning with `ZSH_PYENV_QUIET=true`

Diff

 1diff --git a/plugins/pyenv/README.md b/plugins/pyenv/README.md
 2index d063b55b9b64572cd02f192008ce91934215d002..810c679987cdc9a0f5524f8d6efdf41985740d34 100644
 3--- a/plugins/pyenv/README.md
 4+++ b/plugins/pyenv/README.md
 5@@ -1,4 +1,4 @@
 6-# pyenv 
 7+# pyenv
 8 
 9 This plugin looks for [pyenv](https://github.com/pyenv/pyenv), a Simple Python version
10 management system, and loads it if it's found. It also loads pyenv-virtualenv, a pyenv
11@@ -10,6 +10,11 @@ To use it, add `pyenv` to the plugins array in your zshrc file:
12 plugins=(... pyenv)
13 ```
14 
15+## Settings
16+
17+- `ZSH_PYENV_QUIET`: if set to `true`, the plugin will not print any messages if it
18+  finds that `pyenv` is not properly configured.
19+
20 ## Functions
21 
22 - `pyenv_prompt_info`: displays the Python version in use by pyenv; or the global Python
23diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh
24index f55701900196e882178adaf87560abfff965f8f4..679fc5e528bd485a7afae469523d605635c30f89 100644
25--- a/plugins/pyenv/pyenv.plugin.zsh
26+++ b/plugins/pyenv/pyenv.plugin.zsh
27@@ -1,4 +1,6 @@
28 pyenv_config_warning() {
29+  [[ "$ZSH_PYENV_QUIET" != true ]] || return 0
30+
31   local reason="$1"
32   local pyenv_root="${PYENV_ROOT/#$HOME/\$HOME}"
33   cat >&2 <<EOF