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

Method print_results

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

Print the results of adding files.

(&self, total_stats: &AggregateStats)

Source from the content-addressed store, hash-verified

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
394impl 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