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

Method format_short

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

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