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

Method format_json

atomic-cli/src/commands/log/command.rs:390–396  ·  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

388 ///
389 /// Formatted JSON string.
390 pub(crate) fn format_json(&self, entries: &[HistoryEntry]) -> String {
391 let json_entries: Vec<JsonLogEntry> =
392 entries.iter().map(JsonLogEntry::from_entry).collect();
393
394 serde_json::to_string_pretty(&json_entries)
395 .unwrap_or_else(|e| format!("{{\"error\": \"Failed to serialize: {}\"}}", e))
396 }
397
398 /// Print entries in the configured format.
399 ///

Calls 1

iterMethod · 0.45