Skip to content

fix: emit JSON errors for --json commands#22

Open
nanookclaw wants to merge 1 commit into
ghostwright:mainfrom
nanookclaw:fix/json-errors
Open

fix: emit JSON errors for --json commands#22
nanookclaw wants to merge 1 commit into
ghostwright:mainfrom
nanookclaw:fix/json-errors

Conversation

@nanookclaw
Copy link
Copy Markdown

Summary

Closes #8.

When a command returns an error after --json has been parsed, the CLI now writes a JSON object to stderr instead of plain text:

{"error":"accepts 1 arg(s), received 0"}

The default non-JSON path is unchanged and still writes the original error text.

Verification

  • go test ./cmd/specter/commands
  • go test ./...
  • go run ./cmd/specter --json status
  • go run ./cmd/specter status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Return JSON errors when --json flag is set

1 participant