Skip to content

Commit

Permalink
🚸 Improve message when no files are modified (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kludex committed Dec 27, 2023
1 parent f5ef976 commit cb08b98
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions bump_pydantic/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ def main(
filtered_files = [file for file in all_files if not any(match_glob(file, pattern) for pattern in ignore)]
files = [str(file.relative_to(".")) for file in filtered_files]

if files:
console.log(f"Found {len(files)} files to process")
if len(files) == 1:
console.log("Found 1 file to process.")
elif len(files) > 1:
console.log(f"Found {len(files)} files to process.")
else:
console.log("No files to process.")
raise Exit()
Expand Down Expand Up @@ -137,8 +139,11 @@ def main(

modified = [Path(f) for f in files if os.stat(f).st_mtime > start_time]

if modified and not diff:
console.log(f"Refactored {len(modified)} files.")
if not diff:
if modified:
console.log(f"Refactored {len(modified)} files.")
else:
console.log("No files were modified.")

for _difflines in difflines:
color_diff(console, _difflines)
Expand Down

0 comments on commit cb08b98

Please sign in to comment.