Skip to content

Add --output flag with JSON structured output infrastructure#263

Merged
AndreyVMarkelov merged 1 commit into
masterfrom
output-format-flag
Jun 22, 2026
Merged

Add --output flag with JSON structured output infrastructure#263
AndreyVMarkelov merged 1 commit into
masterfrom
output-format-flag

Conversation

@AndreyVMarkelov

@AndreyVMarkelov AndreyVMarkelov commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replace the boolean --json flag with a global --output string flag (text, json) on the root command
  • Add annotation-based opt-in: commands call enableStructuredOutput(cmd) to support --output=json; unannotated commands return a clear structured output is not supported for this command yet error
  • Add jsonMetadata struct for serializing file/folder/deleted metadata to JSON, decoupled from SDK types
  • Validate output format early in PersistentPreRunE (before auth) across root, login, logout, and team commands

Test plan

  • go vet ./... clean
  • golangci-lint run ./... clean
  • All tests pass (go test ./... -count=1)
  • Manual: dbxcli ls --output=json returns unsupported error (no command opted in yet)
  • Manual: dbxcli ls --output=yaml returns invalid format error

Replace the boolean --json flag with a string --output flag (text, json).
Commands opt in to JSON support via an annotation; unsupported commands
return a clear error. Add jsonMetadata struct for file/folder metadata
serialization decoupled from SDK types.
@AndreyVMarkelov AndreyVMarkelov merged commit 8821dd7 into master Jun 22, 2026
7 checks passed
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.

1 participant