Menu

Argon gc and restore now emit JSON
📰

Argon gc and restore now emit JSON

DEV Community: go·Indra Prasetya·about 2 hours ago
#rZK0s7H3
#devtogo#devto#dev#argon#restore
Reading 0:00
15s threshold

Four argon commands printed only text, so a script could not read their result: argon gc and the three argon restore subcommands, preview, reset, and branch. A human could read the output, but nothing else could. The fix in argon-lab/argon#99 registers all four in the shared -o/--output list, so they take -o json like the rest of the CLI, and documents the shape of what they emit.

What changed

cli/cmd/output.go gains gcCmd , restorePreviewCmd , restoreResetCmd , and restoreBranchCmd in the shared output list. That single registration is what makes -o json available on all four.

The JSON bodies are built by small functions, gcReportJSON , restorePreviewJSON , restoreResetJSON , and restoreBranchJSON , so their shape is testable without a live project or WAL. That matters here because gc and restore need a real project to exercise end to end.

The shapes:

gc emits dry_run , branches (each branch name plus its cutoffs map), and entries_removed .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.