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

Method format_short

atomic-cli/src/commands/change/command.rs:449–494  ·  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

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