From 8bf536ab9f42d6830e40b647310b96ec0d2e3587 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Wed, 20 Sep 2017 15:04:10 -0400 Subject: [PATCH] graph --json #612 Signed-off-by: Kenneth Reitz Signed-off-by: Kenneth Reitz --- pipenv/cli.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pipenv/cli.py b/pipenv/cli.py index 78f72aa6..ebbf140a 100644 --- a/pipenv/cli.py +++ b/pipenv/cli.py @@ -1911,7 +1911,8 @@ def check(three=None, python=False): @click.command(help=u"Displays currently–installed dependency graph information.") @click.option('--bare', is_flag=True, default=False, help="Minimal output.") -def graph(bare=False): +@click.option('--json', is_flag=True, default=False, help="Output JSON.") +def graph(bare=False, json=False): try: python_path = which('python') except AttributeError: @@ -1924,9 +1925,15 @@ def graph(bare=False): ) sys.exit(1) - cmd = '"{0}" {1}'.format( + if json: + bare = True + + j = '--json' if json else '' + + cmd = '"{0}" {1} {2}'.format( python_path, - shellquote(pipdeptree.__file__.rstrip('cdo')) + shellquote(pipdeptree.__file__.rstrip('cdo')), + j ) # Run dep-tree.