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

Method format_json

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

Format entries for JSON output. # Arguments `entries` - History entries to format # Returns Formatted JSON string.

(&self, entries: &[HistoryEntry])

Source from the content-addressed store, hash-verified

415 ///
416 /// Formatted JSON string.
417 pub(crate) fn format_json(&self, entries: &[HistoryEntry]) -> String {
418 let json_entries: Vec<JsonLogEntry> =
419 entries.iter().map(JsonLogEntry::from_entry).collect();
420
421 serde_json::to_string_pretty(&json_entries)
422 .unwrap_or_else(|e| format!("{{\"error\": \"Failed to serialize: {}\"}}", e))
423 }
424
425 /// Print entries in the configured format.
426 ///

Calls 2

collectMethod · 0.45
iterMethod · 0.45