Skip to content

Commit 16d48c0

Browse files
committed
[__main__] include stdout no diff message when there is no difference
1 parent 15485c3 commit 16d48c0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/fdiff/__main__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,17 @@ def run(argv):
144144
iterable = diff
145145

146146
# print unified diff results to standard output stream
147+
# TODO: add support for text output to indicate that there was no diff found
148+
# TODO: ( see https://stackoverflow.com/a/661967 )
149+
has_output = False
147150
if args.color:
148151
for line in iterable:
152+
has_output = True
149153
sys.stdout.write(color_unified_diff_line(line))
150154
else:
151-
sys.stdout.writelines(iterable)
155+
for line in iterable:
156+
has_output = True
157+
sys.stdout.write(line)
158+
159+
if not has_output:
160+
print("[*] There is no difference between the files.")

0 commit comments

Comments
 (0)