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

Method print_long_format

atomic-cli/src/commands/status.rs:246–372  ·  view source on GitHub ↗

Print the status in long (human-readable) format.

(&self, status: &RepositoryStatus)

Source from the content-addressed store, hash-verified

244
245 /// Print the status in long (human-readable) format.
246 fn print_long_format(&self, status: &RepositoryStatus) -> CliResult<()> {
247 // Print view info
248 print!("On view ");
249 println!("{}", style_view(status.view()));
250
251 // Print state hash if available
252 if let Some(state) = status.state() {
253 let state_str = state.to_base32();
254 // Truncate to default hash length for display
255 let short_state = if state_str.len() > DEFAULT_HASH_LENGTH {
256 format!("{}...", &state_str[..DEFAULT_HASH_LENGTH])
257 } else {
258 state_str
259 };
260 print!("State: ");
261 println!("{}", hash(&short_state));
262 }
263
264 print_blank();
265
266 // Check if there are any changes
267 let has_changes = status.modified_count() > 0
268 || status.deleted_count() > 0
269 || status.added_count() > 0
270 || status.conflicted_count() > 0;
271
272 let has_untracked = status.untracked_count() > 0;
273
274 if !has_changes && !has_untracked {
275 println!("{}", info("nothing to record, working tree clean"));
276 return Ok(());
277 }
278
279 // Print changes section
280 if has_changes {
281 print_section("Changes to be recorded:");
282 println!(
283 " {}",
284 hint("(use \"atomic restore <file>...\" to discard changes)")
285 );
286 print_blank();
287
288 // Print added files and directories
289 for entry in status.added() {
290 let path_str = entry.path().display().to_string();
291 let is_dir = entry.details().map(|d| d == "directory").unwrap_or(false);
292 if is_dir {
293 println!("\t{} {}", added("new dir:"), style_path(&path_str));
294 } else {
295 println!("\t{} {}", added("new file:"), style_path(&path_str));
296 }
297 }
298
299 // Print modified files
300 for entry in status.modified() {
301 let path_str = entry.path().display().to_string();
302 println!("\t{} {}", modified("modified:"), style_path(&path_str));
303 }

Calls 15

print_blankFunction · 0.85
print_sectionFunction · 0.85
print_hintFunction · 0.85
conflicted_countMethod · 0.80
untracked_countMethod · 0.80
displayMethod · 0.80
detailsMethod · 0.80
conflictedMethod · 0.80
untrackedMethod · 0.80
needs_reindexMethod · 0.80
stateMethod · 0.45
to_base32Method · 0.45