Skip to content

Commit

Permalink
fix: only show diff for changed files
Browse files Browse the repository at this point in the history
  • Loading branch information
mbhall88 committed Mar 5, 2023
1 parent 610762f commit 7b35c16
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions snakefmt/snakefmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,11 @@ def main(
LogConfig.switch()
if diff or compact_diff:
filename = "stdin" if path_is_stdin else str(path)
click.echo(f"{'=' * 5}> Diff for {filename} <{'=' * 5}\n")
difference = differ.compare(original_content, formatted_content)
click.echo(difference)
is_changed = differ.is_changed(original_content, formatted_content)
if is_changed:
difference = differ.compare(original_content, formatted_content)
click.echo(f"{'=' * 5}> Diff for {filename} <{'=' * 5}\n")
click.echo(difference)
elif not any([check, diff, compact_diff]):
if path_is_stdin:
sys.stdout.write(formatted_content)
Expand Down

0 comments on commit 7b35c16

Please sign in to comment.