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

Method format_json

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

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

Calls 1

iterMethod · 0.45