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

Method render

atomic-cli/src/commands/diff/helpers.rs:79–97  ·  view source on GitHub ↗

Render a computed diff in the requested format. `--json` wins over every text format selector, so a consumer gets a single parseable document rather than a rendered diff it has to re-parse. `change` is `Some` for `atomic diff -c `; `view` is populated only for working-copy diffs.

(
        &self,
        file_diffs: &[FileDiff],
        stats: &DiffStats,
        config: &DiffOutputConfig,
        change: Option<(&Change, &Hash)>,
        view: Option<&str>,
    )

Source from the content-addressed store, hash-verified

77 /// re-parse. `change` is `Some` for `atomic diff -c <hash>`; `view` is
78 /// populated only for working-copy diffs.
79 pub(crate) fn render(
80 &self,
81 file_diffs: &[FileDiff],
82 stats: &DiffStats,
83 config: &DiffOutputConfig,
84 change: Option<(&Change, &Hash)>,
85 view: Option<&str>,
86 ) -> CliResult<()> {
87 if self.json {
88 return json::print_json(&json::JsonDiff::new(file_diffs, stats, change, view));
89 }
90
91 match config.format {
92 DiffFormat::Unified => self.print_unified(file_diffs, config),
93 DiffFormat::Stat => self.print_stat(stats, config),
94 DiffFormat::NameOnly => self.print_name_only(file_diffs),
95 DiffFormat::NameStatus => self.print_name_status(file_diffs, config),
96 }
97 }
98
99 /// Print a message when there are no changes.
100 pub(super) fn print_no_changes(&self) {

Callers 4

run_git_diffMethod · 0.45
runMethod · 0.45

Calls 5

print_unifiedMethod · 0.80
print_statMethod · 0.80
print_name_onlyMethod · 0.80
print_name_statusMethod · 0.80
print_jsonFunction · 0.70

Tested by

no test coverage detected