Skip to content

Commit aa2616f

Browse files
committed
List unformatted files when running the check option
Close GDQuest#198
1 parent 0a4195e commit aa2616f

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
265265
// If true, all input files were already formatted (used for check mode)
266266
let mut all_formatted = true;
267267
let mut modified_file_count = 0;
268+
let mut unformatted_files = Vec::new();
268269
for output in sorted_outputs {
269270
match output {
270271
Ok(output) => {
271272
if args.check {
272273
if !output.is_formatted {
273274
all_formatted = false;
275+
unformatted_files.push(output.file_path);
274276
}
275277
} else if args.stdout {
276278
// Clear the progress message before printing formatted files to stdout
@@ -307,6 +309,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
307309
} else {
308310
terminal_clear_line();
309311
eprintln!("\rSome files are not formatted");
312+
for file_path in unformatted_files {
313+
eprintln!("{}", file_path.display());
314+
}
310315
std::process::exit(1);
311316
}
312317
} else if !args.stdout {

0 commit comments

Comments
 (0)