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

Method format_short

atomic-cli/src/commands/change/command.rs:453–498  ·  view source on GitHub ↗

Format the change for short output.

(
        &self,
        change: &Change,
        hash: &Hash,
        sequence: Option<u64>,
    )

Source from the content-addressed store, hash-verified

451
452 /// Format the change for short output.
453 pub(crate) fn format_short(
454 &self,
455 change: &Change,
456 hash: &Hash,
457 sequence: Option<u64>,
458 ) -> String {
459 let hash_len = self.get_hash_length();
460 let hash_str = format_hash_with_length(hash, hash_len);
461
462 let date_str = change
463 .hashed
464 .header
465 .timestamp
466 .format("%Y-%m-%d")
467 .to_string();
468
469 let author_name = change
470 .hashed
471 .header
472 .authors
473 .first()
474 .map(|a| truncate_string(&a.name, 15))
475 .unwrap_or_else(|| "(unknown)".to_string());
476
477 let message = change
478 .hashed
479 .header
480 .message
481 .lines()
482 .next()
483 .unwrap_or("(no message)");
484
485 // Provenance indicator for short format
486 let _prov_indicator = if change.has_provenance() { " 🤖" } else { "" };
487
488 let seq_str = sequence.map(|s| format!(" #{}", s)).unwrap_or_default();
489
490 format!(
491 "{}{} {} {:15} {}\n",
492 style_hash(&hash_str),
493 hint(&seq_str),
494 style_timestamp(&date_str),
495 style_author(&author_name),
496 message
497 )
498 }
499
500 /// Format AI attestation information for display.
501 fn format_attestation(&self, prov: &Provenance) -> String {

Callers 5

print_changeMethod · 0.45
test_format_short_basicFunction · 0.45

Calls 7

format_hash_with_lengthFunction · 0.85
truncate_stringFunction · 0.70
get_hash_lengthMethod · 0.45
formatMethod · 0.45
nextMethod · 0.45
linesMethod · 0.45
has_provenanceMethod · 0.45