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)
| 327 | /// |
| 328 | /// Formatted output string. |
| 329 | pub(crate) fn format_short(&self, entries: &[HistoryEntry], hash_length: usize) -> String { |
| 330 | let mut output = String::new(); |
| 331 | |
| 332 | for entry in entries { |
| 333 | let hash_str = format_hash_with_length(&entry.hash, hash_length); |
| 334 | let message = entry.message().unwrap_or("(no message)"); |
| 335 | // Get just the first line |
| 336 | let first_line = message.lines().next().unwrap_or(message); |
| 337 | |
| 338 | let tagged_marker = if entry.is_tagged { " *" } else { "" }; |
| 339 | output.push_str(&format!( |
| 340 | "{}{} {}\n", |
| 341 | style_hash(&hash_str), |
| 342 | hint(tagged_marker), |
| 343 | first_line |
| 344 | )); |
| 345 | } |
| 346 | |
| 347 | output |
| 348 | } |
| 349 | |
| 350 | /// Format entries for oneline output. |
| 351 | /// |