MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / print_results

Method print_results

atomic-cli/src/commands/add.rs:331–383  ·  view source on GitHub ↗

Print the results of adding files.

(&self, total_stats: &AggregateStats)

Source from the content-addressed store, hash-verified

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

Callers 1

runMethod · 0.80

Calls 7

print_blankFunction · 0.85
print_warningFunction · 0.85
print_successFunction · 0.85
print_hintFunction · 0.85
format_countFunction · 0.70
total_addedMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected