From c64aebef08529cd65b505f5d8bb326930775b378 Mon Sep 17 00:00:00 2001 From: "Yamashita, Yuu" Date: Mon, 2 May 2016 01:07:48 +0000 Subject: [PATCH 1/3] 1) Made `--quiet` as opposite of `--verbose` 2) Suppress warning about prompts on `--quiet` --- bin/pyenv-sh-activate | 13 ++++++++----- bin/pyenv-sh-deactivate | 3 +-- test/activate.bats | 27 ++++++++++++++++++++++++++- test/deactivate.bats | 30 ++++++++++++++++++++++++++++++ test/init.bats | 0 5 files changed, 65 insertions(+), 8 deletions(-) mode change 100755 => 100644 test/init.bats diff --git a/bin/pyenv-sh-activate b/bin/pyenv-sh-activate index 8beb631..d2f4081 100755 --- a/bin/pyenv-sh-activate +++ b/bin/pyenv-sh-activate @@ -24,7 +24,6 @@ resolve_link() { unset FORCE unset QUIET -unset VERBOSE while [ $# -gt 0 ]; do case "$1" in @@ -47,7 +46,7 @@ while [ $# -gt 0 ]; do exec pyenv-sh-deactivate ;; "-v" | "--verbose" ) - VERBOSE=1 + unset QUIET ;; * ) break @@ -136,7 +135,7 @@ if [[ "${VIRTUAL_ENV}" == "${prefix}" ]]; then fi fi -pyenv-sh-deactivate --force --quiet ${VERBOSE+--verbose} || true +pyenv-sh-deactivate --force --quiet || true if [ -n "$PYENV_VIRTUALENV_VERBOSE_ACTIVATE" ]; then echo "pyenv-virtualenv: activate ${venv}" 1>&2 @@ -220,10 +219,14 @@ PYENV_VIRTUALENV_DISABLE_PROMPT="${PYENV_VIRTUALENV_DISABLE_PROMPT:-${VIRTUAL_EN if [ -z "${PYENV_VIRTUALENV_DISABLE_PROMPT}" ]; then case "${shell}" in fish ) - echo "pyenv-virtualenv: prompt changing not working for fish." 1>&2 + if [ -z "${QUIET}" ]; then + echo "pyenv-virtualenv: prompt changing not working for fish." 1>&2 + fi ;; * ) - echo "pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior." 1>&2 + if [ -z "${QUIET}" ]; then + echo "pyenv-virtualenv: prompt changing will be removed from future release. configure \`export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior." 1>&2 + fi cat </dev/null 2>&1; then + unset -f deactivate; +fi; +EOS +} + @test "deactivate virtualenv (verbose)" { export PYENV_VIRTUALENV_INIT=1 export PYENV_VIRTUAL_ENV="${PYENV_ROOT}/versions/venv" diff --git a/test/init.bats b/test/init.bats old mode 100755 new mode 100644 From 08cfea259c699bbe590183e224016d7848f70e2e Mon Sep 17 00:00:00 2001 From: "Yamashita, Yuu" Date: Sat, 7 May 2016 13:19:37 +0000 Subject: [PATCH 2/3] Remove backward compat `--no-error` option --- bin/pyenv-sh-activate | 4 ---- bin/pyenv-sh-deactivate | 4 ---- 2 files changed, 8 deletions(-) diff --git a/bin/pyenv-sh-activate b/bin/pyenv-sh-activate index d2f4081..fdb326b 100755 --- a/bin/pyenv-sh-activate +++ b/bin/pyenv-sh-activate @@ -35,10 +35,6 @@ while [ $# -gt 0 ]; do "-f" | "--force" ) FORCE=1 ;; - "--no-error" ) - # for backward compatibility with v20151103 and earlier - QUIET=1 - ;; "-q" | "--quiet" ) QUIET=1 ;; diff --git a/bin/pyenv-sh-deactivate b/bin/pyenv-sh-deactivate index 4321167..cceaa19 100755 --- a/bin/pyenv-sh-deactivate +++ b/bin/pyenv-sh-deactivate @@ -21,10 +21,6 @@ while [ $# -gt 0 ]; do "-f" | "--force" ) FORCE=1 ;; - "--no-error" ) - # for backward compatibility with v20151103 and earlier - QUIET=1 - ;; "-q" | "--quiet") QUIET=1 ;; From 1cb6bb06eff82d3e675b342a007ddab575a7c49d Mon Sep 17 00:00:00 2001 From: "Yamashita, Yuu" Date: Sat, 7 May 2016 13:45:00 +0000 Subject: [PATCH 3/3] Turn `PYENV_VIRTUALENV_VERBOSE_ACTIVATE` on if `--verbose` is given --- bin/pyenv-sh-activate | 1 + bin/pyenv-sh-deactivate | 1 + 2 files changed, 2 insertions(+) diff --git a/bin/pyenv-sh-activate b/bin/pyenv-sh-activate index fdb326b..53452d4 100755 --- a/bin/pyenv-sh-activate +++ b/bin/pyenv-sh-activate @@ -43,6 +43,7 @@ while [ $# -gt 0 ]; do ;; "-v" | "--verbose" ) unset QUIET + PYENV_VIRTUALENV_VERBOSE_ACTIVATE=1 ;; * ) break diff --git a/bin/pyenv-sh-deactivate b/bin/pyenv-sh-deactivate index cceaa19..134a8f2 100755 --- a/bin/pyenv-sh-deactivate +++ b/bin/pyenv-sh-deactivate @@ -26,6 +26,7 @@ while [ $# -gt 0 ]; do ;; "-v" | "--verbose" ) unset QUIET + PYENV_VIRTUALENV_VERBOSE_ACTIVATE=1 ;; * ) break