Skip to content

Commit e83510a

Browse files
committed
added the necessary changes to CLI
Signed-off-by: Pratikrocks <pratikrocks.dey11@gmail.com>
1 parent d9973f8 commit e83510a

3 files changed

Lines changed: 4 additions & 28 deletions

File tree

src/deltacode/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ def __str__(self):
359359

360360
return (" {\n"+
361361
" status: " + str(self.status) + "\n"
362-
" factors: [" + " ".join(self.factors) + "]\n" +
362+
" factors: [" + ", ".join(self.factors) + "]\n" +
363363
" score: " + str(self.score) + "\n"+
364364
" new_file: " + new_file_path + "\n"+
365365
" old_file: " + old_file_path + "\n" +

src/deltacode/cli.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
from deltacode import DeltaCode
3434
from deltacode import __version__
35-
from deltacode.utils import deltas, get_notice, collect_errors,get_notice_for_cli
35+
from deltacode.utils import deltas, get_notice, collect_errors
3636

3737

3838
def write_json(deltacode, outfile, all_delta_types=False):
@@ -57,8 +57,7 @@ def write_json(deltacode, outfile, all_delta_types=False):
5757
simplejson.dump(results, outfile, iterable_as_array=True, indent=2)
5858
outfile.write('\n')
5959
if outfile.name != '<stdout>' :
60-
"This condition arises when we are required to print in the json file and the value of -j in not the console terminal"
61-
click.secho(get_notice_for_cli(),fg="green")
60+
"This condition arises when we are required to print in the json file and the value of -j in not the console terminal"
6261
click.echo('deltas_count: {}'.format(len([d for d in deltas(deltacode, all_delta_types)])))
6362
click.echo('delta_stats: ')
6463
for stat in deltacode.stats.to_dict():
@@ -68,13 +67,9 @@ def write_json(deltacode, outfile, all_delta_types=False):
6867
delta_count = 1
6968
for delta in deltacode.deltas :
7069
if delta.status != "unmodified":
71-
click.echo("\n")
72-
click.secho("delta {}".format(delta_count))
70+
click.echo("delta {}".format(delta_count))
7371
click.echo(delta)
7472
delta_count += 1
75-
click.secho("#" * 211 + "\n",fg="yellow")
76-
click.secho(" "*70 + "All deltas are generated, view the json file for details" + "\n" , fg="green")
77-
click.secho("#" * 211,fg="yellow")
7873

7974
except Exception as e:
8075
"This exception arises when outfile has no name attribute"

src/deltacode/utils.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -264,25 +264,6 @@ def check_moved(added_sha1, added_deltas, removed_sha1, removed_deltas):
264264
if added_deltas[0].new_file.name == removed_deltas[0].old_file.name:
265265
return True
266266

267-
def get_notice_for_cli():
268-
"""
269-
Retrieve the notice text from the NOTICE file for display in the Command Line .
270-
"""
271-
notice_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'NOTICE')
272-
notice_text = open(notice_path).read()
273-
274-
delimiter = '\n\n\n'
275-
[notice_text, extra_notice_text] = notice_text.split(delimiter, 1)
276-
extra_notice_text = delimiter + extra_notice_text
277-
278-
delimiter = '\n\n '
279-
[notice_text, acknowledgment_text] = notice_text.split(delimiter, 1)
280-
acknowledgment_text = delimiter + acknowledgment_text
281-
282-
notice = acknowledgment_text.strip().replace('\n', '')
283-
284-
return notice
285-
286267
def get_notice():
287268
"""
288269
Retrieve the notice text from the NOTICE file for display in the JSON output.

0 commit comments

Comments
 (0)