From 8d70bf3533db49d53fcb5b98b3f2ab26e5b1dcd1 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Tue, 19 Sep 2017 21:09:37 -0400 Subject: [PATCH] --py Signed-off-by: Kenneth Reitz --- pipenv/cli.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pipenv/cli.py b/pipenv/cli.py index 527a5dae..71d1a57d 100644 --- a/pipenv/cli.py +++ b/pipenv/cli.py @@ -1321,6 +1321,7 @@ def kr_easter_egg(package_name): @click.option('--update', is_flag=True, default=False, help="Update Pipenv & pip to latest.") @click.option('--where', is_flag=True, default=False, help="Output project home information.") @click.option('--venv', is_flag=True, default=False, help="Output virtualenv information.") +@click.option('--py', is_flag=True, default=False, help="Output Python interpreter information.") @click.option('--rm', is_flag=True, default=False, help="Remove the virtualenv.") @click.option('--bare', is_flag=True, default=False, help="Minimal output.") @click.option('--three/--two', is_flag=True, default=None, help="Use Python 3/2 when creating virtualenv.") @@ -1331,7 +1332,7 @@ def kr_easter_egg(package_name): @click.pass_context def cli( ctx, where=False, venv=False, rm=False, bare=False, three=False, - python=False, help=False, update=False, jumbotron=False + python=False, help=False, update=False, jumbotron=False, py=False ): if jumbotron: @@ -1367,6 +1368,10 @@ def cli( do_where(bare=bare) sys.exit(0) + elif py: + do_py() + sys.exit() + # --venv was passed... elif venv: # There is no virtualenv yet. @@ -1413,6 +1418,9 @@ def cli( click.echo(format_help(ctx.get_help())) +def do_py(system=False): + click.echo(which('python', allow_global=system)) + @click.command(help="Installs provided packages and adds them to Pipfile, or (if none is given), installs all packages.", context_settings=dict( ignore_unknown_options=True, allow_extra_args=True