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

Method display_dry_run

atomic-cli/src/commands/record/format.rs:79–127  ·  view source on GitHub ↗

Display dry run preview.

(&self, repo: &Repository)

Source from the content-addressed store, hash-verified

77
78 /// Display dry run preview.
79 pub(super) fn display_dry_run(&self, repo: &Repository) -> CliResult<()> {
80 let status = repo
81 .status(StatusOptions::default())
82 .map_err(CliError::Repository)?;
83
84 let mut has_changes = false;
85
86 println!("Would record:");
87
88 for entry in status.entries() {
89 // Skip untracked unless --all
90 if matches!(entry.status(), FileStatus::Untracked) && !self.all {
91 continue;
92 }
93
94 // Skip clean files
95 if matches!(entry.status(), FileStatus::Clean) {
96 continue;
97 }
98
99 // Filter by specified files if any
100 if !self.files.is_empty() {
101 let path_str = entry.path().to_string_lossy();
102 if !self.files.iter().any(|f| path_str.contains(f)) {
103 continue;
104 }
105 }
106
107 has_changes = true;
108 let status_desc = match entry.status() {
109 FileStatus::Added => "new file:",
110 FileStatus::Modified => "modified:",
111 FileStatus::Deleted => "deleted: ",
112 FileStatus::Untracked => "new file:",
113 FileStatus::TypeChanged => "typechange:",
114 FileStatus::PermissionsChanged => "permissions:",
115 FileStatus::Conflicted => "conflicted:",
116 FileStatus::Clean => continue,
117 };
118
119 println!(" {} {}", status_desc, entry.path().to_string_lossy());
120 }
121
122 if !has_changes {
123 println!(" (no changes to record)");
124 }
125
126 Ok(())
127 }
128}
129
130impl Default for Record {

Callers 1

runMethod · 0.45

Calls 6

entriesMethod · 0.80
statusMethod · 0.45
is_emptyMethod · 0.45
pathMethod · 0.45
iterMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected