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

Method print_name_status

atomic-cli/src/commands/diff/format.rs:458–481  ·  view source on GitHub ↗

Print file names with status.

(
        &self,
        file_diffs: &[FileDiff],
        config: &DiffOutputConfig,
    )

Source from the content-addressed store, hash-verified

456
457 /// Print file names with status.
458 pub(crate) fn print_name_status(
459 &self,
460 file_diffs: &[FileDiff],
461 config: &DiffOutputConfig,
462 ) -> CliResult<()> {
463 for file_diff in file_diffs {
464 let status_char = file_diff.status.status_char();
465 let path = file_diff.display_path();
466
467 if config.color {
468 let status_str = status_char.to_string();
469 let styled_status = match file_diff.status {
470 FileChangeStatus::Added => added(&status_str),
471 FileChangeStatus::Deleted => deleted(&status_str),
472 FileChangeStatus::Modified => modified(&status_str),
473 _ => info(&status_str),
474 };
475 println!("{} {}", styled_status, style_path(path));
476 } else {
477 println!("{} {}", status_char, path);
478 }
479 }
480 Ok(())
481 }
482}

Callers 1

renderMethod · 0.80

Calls 6

addedFunction · 0.85
deletedFunction · 0.85
modifiedFunction · 0.85
infoFunction · 0.85
status_charMethod · 0.45
display_pathMethod · 0.45

Tested by

no test coverage detected