Skip to content

Commit e7d1458

Browse files
authored
Merge pull request #5966 from fmssn/enhancement-5954-reduce-notifications
Add quiet option to pipenv shell.
2 parents 16a6d76 + 9c1344e commit e7d1458

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

news/5966.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add quiet option to pipenv shell, hiding "Launching subshell in virtual environment..."

pipenv/cli/command.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -364,16 +364,14 @@ def lock(ctx, state, **kwargs):
364364
default=False,
365365
help="Always spawn a sub-shell, even if one is already spawned.",
366366
)
367+
@option(
368+
"--quiet", is_flag=True, help="Quiet standard output, except vulnerability report."
369+
)
367370
@argument("shell_args", nargs=-1)
368371
@pypi_mirror_option
369372
@python_option
370373
@pass_state
371-
def shell(
372-
state,
373-
fancy=False,
374-
shell_args=None,
375-
anyway=False,
376-
):
374+
def shell(state, fancy=False, shell_args=None, anyway=False, quiet=False):
377375
"""Spawns a shell within the virtualenv."""
378376
from pipenv.routines.shell import do_shell
379377

@@ -399,6 +397,7 @@ def shell(
399397
fancy=fancy,
400398
shell_args=shell_args,
401399
pypi_mirror=state.pypi_mirror,
400+
quiet=quiet,
402401
)
403402

404403

pipenv/routines/shell.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
from pipenv.vendor import click
1010

1111

12-
def do_shell(project, python=False, fancy=False, shell_args=None, pypi_mirror=None):
12+
def do_shell(
13+
project, python=False, fancy=False, shell_args=None, pypi_mirror=None, quiet=False
14+
):
1315
# Ensure that virtualenv is available.
1416
ensure_project(
1517
project,
@@ -25,7 +27,8 @@ def do_shell(project, python=False, fancy=False, shell_args=None, pypi_mirror=No
2527
from pipenv.shells import choose_shell
2628

2729
shell = choose_shell(project)
28-
click.echo("Launching subshell in virtual environment...", err=True)
30+
if not quiet:
31+
click.echo("Launching subshell in virtual environment...", err=True)
2932

3033
fork_args = (
3134
project.virtualenv_location,

0 commit comments

Comments
 (0)