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