Merge pull request #5966 from fmssn/enhancement-5954-reduce-notifications

Add quiet option to pipenv shell.
This commit is contained in:
Matt Davis
2023-10-16 06:10:54 -04:00
committed by GitHub
3 changed files with 11 additions and 8 deletions
+1
View File
@@ -0,0 +1 @@
Add quiet option to pipenv shell, hiding "Launching subshell in virtual environment..."
+5 -6
View File
@@ -364,16 +364,14 @@ def lock(ctx, state, **kwargs):
default=False,
help="Always spawn a sub-shell, even if one is already spawned.",
)
@option(
"--quiet", is_flag=True, help="Quiet standard output, except vulnerability report."
)
@argument("shell_args", nargs=-1)
@pypi_mirror_option
@python_option
@pass_state
def shell(
state,
fancy=False,
shell_args=None,
anyway=False,
):
def shell(state, fancy=False, shell_args=None, anyway=False, quiet=False):
"""Spawns a shell within the virtualenv."""
from pipenv.routines.shell import do_shell
@@ -399,6 +397,7 @@ def shell(
fancy=fancy,
shell_args=shell_args,
pypi_mirror=state.pypi_mirror,
quiet=quiet,
)
+5 -2
View File
@@ -9,7 +9,9 @@ from pipenv.utils.shell import cmd_list_to_shell, system_which
from pipenv.vendor import click
def do_shell(project, python=False, fancy=False, shell_args=None, pypi_mirror=None):
def do_shell(
project, python=False, fancy=False, shell_args=None, pypi_mirror=None, quiet=False
):
# Ensure that virtualenv is available.
ensure_project(
project,
@@ -25,7 +27,8 @@ def do_shell(project, python=False, fancy=False, shell_args=None, pypi_mirror=No
from pipenv.shells import choose_shell
shell = choose_shell(project)
click.echo("Launching subshell in virtual environment...", err=True)
if not quiet:
click.echo("Launching subshell in virtual environment...", err=True)
fork_args = (
project.virtualenv_location,