graph --json

#612

Signed-off-by: Kenneth Reitz <me@kennethreitz.org>

Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
This commit is contained in:
2017-09-20 15:04:10 -04:00
parent ba5c5cbf94
commit 8bf536ab9f
+10 -3
View File
@@ -1911,7 +1911,8 @@ def check(three=None, python=False):
@click.command(help=u"Displays currentlyinstalled 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.