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

Method print_long_format

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

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

(&self, status: &RepositoryStatus)

Source from the content-addressed store, hash-verified

383
384 /// Print the status in long (human-readable) format.
385 fn print_long_format(&self, status: &RepositoryStatus) -> CliResult<()> {
386 // Print view info
387 print!("On view ");
388 println!("{}", style_view(status.view()));
389
390 // Print state hash if available
391 if let Some(state) = status.state() {
392 let state_str = state.to_base32();
393 // Truncate to default hash length for display
394 let short_state = if state_str.len() > DEFAULT_HASH_LENGTH {
395 format!("{}...", &state_str[..DEFAULT_HASH_LENGTH])
396 } else {
397 state_str
398 };
399 print!("State: ");
400 println!("{}", hash(&short_state));
401 }
402
403 print_blank();
404
405 // Check if there are any changes
406 let has_changes = status.modified_count() > 0
407 || status.deleted_count() > 0
408 || status.added_count() > 0
409 || status.pending_untrack_count() > 0
410 || status.conflicted_count() > 0
411 || status.type_changed_count() > 0
412 || status.permissions_changed_count() > 0;
413
414 let has_untracked = status.untracked_count() > 0;
415
416 if !has_changes && !has_untracked {
417 println!("{}", info("nothing to record, working tree clean"));
418 return Ok(());
419 }
420
421 // Advisory notices (e.g. the RFC §8.3 conflict-snapshot caveat) are
422 // surfaced before the file listing so the distinction between a
423 // committed conflict snapshot and Git unmerged stages is explicit.
424 for notice in status.notices() {
425 print_warning(notice);
426 }
427
428 // Print changes section
429 if has_changes {
430 print_section("Changes to be recorded:");
431 println!(
432 " {}",
433 hint("(use \"atomic restore <file>...\" to discard changes)")
434 );
435 if status.pending_untrack_count() > 0 {
436 println!(
437 " {}",
438 hint(
439 "(use \"atomic add <file>...\" to cancel a pending untrack; \
440 'atomic record' completes it)"
441 )
442 );

Calls 15

print_blankFunction · 0.85
print_warningFunction · 0.85
print_sectionFunction · 0.85
print_hintFunction · 0.85
pending_untrack_countMethod · 0.80
conflicted_countMethod · 0.80
type_changed_countMethod · 0.80
untracked_countMethod · 0.80
noticesMethod · 0.80
displayMethod · 0.80
detailsMethod · 0.80