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

Method format_short

atomic-cli/src/commands/log/command.rs:308–327  ·  view source on GitHub ↗

Format entries for short output. # Arguments `entries` - History entries to format `hash_length` - Number of hash characters to display # Returns Formatted output string.

(&self, entries: &[HistoryEntry], hash_length: usize)

Source from the content-addressed store, hash-verified

306 ///
307 /// Formatted output string.
308 pub(crate) fn format_short(&self, entries: &[HistoryEntry], hash_length: usize) -> String {
309 let mut output = String::new();
310
311 for entry in entries {
312 let hash_str = format_hash_with_length(&entry.hash, hash_length);
313 let message = entry.message().unwrap_or("(no message)");
314 // Get just the first line
315 let first_line = message.lines().next().unwrap_or(message);
316
317 let tagged_marker = if entry.is_tagged { " *" } else { "" };
318 output.push_str(&format!(
319 "{}{} {}\n",
320 style_hash(&hash_str),
321 hint(tagged_marker),
322 first_line
323 ));
324 }
325
326 output
327 }
328
329 /// Format entries for oneline output.
330 ///

Calls 4

format_hash_with_lengthFunction · 0.85
messageMethod · 0.45
nextMethod · 0.45
linesMethod · 0.45