Skip to content

Commit fd46939

Browse files
committed
added the modified the cli when -j is set to default
Signed-off-by: Pratikrocks <pratikrocks.dey11@gmail.com>
1 parent 9c39ef0 commit fd46939

1 file changed

Lines changed: 16 additions & 13 deletions

File tree

src/deltacode/cli.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,24 @@ def write_json(deltacode, outfile, all_delta_types=False):
5151
('delta_stats', deltacode.stats.to_dict()),
5252
('deltas', deltas(deltacode, all_delta_types))
5353
])
54+
55+
if( outfile.name != '<stdout>'):
5456

55-
click.secho(get_notice_for_cli(),fg="green")
56-
click.echo('deltas_count: {}'.format(len([d for d in deltas(deltacode, all_delta_types)])))
57-
click.echo('delta_stats: ')
58-
for stat in deltacode.stats.to_dict():
59-
click.echo(""" "{}": {}""".format(str(stat),deltacode.stats.to_dict()[stat]))
60-
# TODO: add toggle for pretty printing
57+
click.secho(get_notice_for_cli(),fg="green")
58+
click.echo('deltas_count: {}'.format(len([d for d in deltas(deltacode, all_delta_types)])))
59+
click.echo('delta_stats: ')
60+
for stat in deltacode.stats.to_dict():
61+
click.echo(""" "{}": {}""".format(str(stat),deltacode.stats.to_dict()[stat]))
62+
# TODO: add toggle for pretty printing
63+
64+
delta_count = 1
65+
for delta in deltacode.deltas :
66+
if delta.status != "unmodified":
67+
click.secho("Delta {}".format(delta_count),fg="blue")
68+
click.echo(delta)
69+
delta_count += 1
70+
click.secho("--------------------ALL DELTAS GENERATED--------------------",fg="yellow")
6171

62-
delta_count = 1
63-
for delta in deltacode.deltas :
64-
if delta.status != "unmodified":
65-
click.secho("Delta {}".format(delta_count),fg="blue")
66-
click.echo(delta)
67-
delta_count += 1
68-
click.secho("--------------------ALL DELTAS GENERATED--------------------",fg="yellow")
6972
simplejson.dump(results, outfile, iterable_as_array=True, indent=2)
7073
outfile.write('\n')
7174

0 commit comments

Comments
 (0)