Print the results of adding files.
(&self, total_stats: &AggregateStats)
| 337 | |
| 338 | /// Print the results of adding files. |
| 339 | fn print_results(&self, total_stats: &AggregateStats) { |
| 340 | if self.dry_run { |
| 341 | print_blank(); |
| 342 | println!("{}", hint("(dry run - no changes made)")); |
| 343 | return; |
| 344 | } |
| 345 | |
| 346 | if total_stats.total_added() == 0 { |
| 347 | if total_stats.skipped > 0 { |
| 348 | print_warning(&format!( |
| 349 | "No files added ({} already tracked)", |
| 350 | total_stats.skipped |
| 351 | )); |
| 352 | } else { |
| 353 | println!("{}", info("Nothing to add")); |
| 354 | } |
| 355 | return; |
| 356 | } |
| 357 | |
| 358 | // Format the success message |
| 359 | let mut parts = Vec::new(); |
| 360 | |
| 361 | if total_stats.files_added > 0 { |
| 362 | parts.push(format_count(total_stats.files_added, "file", "files")); |
| 363 | } |
| 364 | |
| 365 | if total_stats.directories_added > 0 { |
| 366 | parts.push(format_count( |
| 367 | total_stats.directories_added, |
| 368 | "directory", |
| 369 | "directories", |
| 370 | )); |
| 371 | } |
| 372 | |
| 373 | if total_stats.explicit_directories > 0 { |
| 374 | parts.push(format_count( |
| 375 | total_stats.explicit_directories, |
| 376 | "empty directory", |
| 377 | "empty directories", |
| 378 | )); |
| 379 | } |
| 380 | |
| 381 | let message = format!("Added {}", parts.join(", ")); |
| 382 | print_success(&message); |
| 383 | |
| 384 | // Show skipped files hint if any |
| 385 | if total_stats.skipped > 0 { |
| 386 | print_hint(&format!( |
| 387 | "{} path(s) already tracked (skipped)", |
| 388 | total_stats.skipped |
| 389 | )); |
| 390 | } |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | impl Default for Add { |
no test coverage detected