Skip to content

refactor(output): unify OutputFormat and standardize table library#760

Merged
joshrotenberg merged 1 commit intomainfrom
refactor/output-format-unification
Mar 3, 2026
Merged

refactor(output): unify OutputFormat and standardize table library#760
joshrotenberg merged 1 commit intomainfrom
refactor/output-format-unification

Conversation

@joshrotenberg
Copy link
Collaborator

Summary

Phase 1 of #749 (output formatting cleanup):

  • Remove duplicate output::OutputFormat enum, re-export cli::OutputFormat as the single source of truth
  • Drop comfy-table dependency, standardize on tabled with Style::blank()
  • Consolidate duplicated apply_jmespath/handle_output/print_formatted_output into output.rs, re-export from cloud/utils.rs and enterprise/utils.rs
  • Standardize Auto mode: table when TTY, JSON when piped
  • Remove manual OutputFormat conversion boilerplate across commands

Net result: -148 lines, one fewer dependency, single code path for output formatting.

Closes #749

Test plan

  • cargo clippy --all-targets --all-features -- -D warnings passes
  • cargo test --lib --all-features passes (89 tests)
  • Verify -o json, -o yaml, -o table work for Cloud and Enterprise commands
  • Verify piped output defaults to JSON, TTY defaults to table

)

Phase 1 of output formatting cleanup:
- Remove duplicate output::OutputFormat enum, re-export cli::OutputFormat
- Drop comfy-table dependency, standardize on tabled with Style::blank()
- Consolidate duplicated apply_jmespath/handle_output/print_formatted_output
  into output.rs, re-export from cloud/utils.rs and enterprise/utils.rs
- Standardize Auto mode: Table when TTY, Json when piped
- Remove manual OutputFormat conversion boilerplate across commands
@joshrotenberg joshrotenberg merged commit e1cd7fe into main Mar 3, 2026
19 checks passed
@joshrotenberg joshrotenberg deleted the refactor/output-format-unification branch March 3, 2026 16:30
joshrotenberg added a commit that referenced this pull request Mar 3, 2026
…761)

Add #[derive(Tabled)] row structs to all Enterprise list and get
commands, replacing the generic print_as_table() which dumped all JSON
fields uncurated. This matches the Cloud command patterns established
in PR #760.

Row structs added: DatabaseRow, NodeRow, UserRow, RoleRow, AclRow,
ModuleRow, ShardRow, ProxyRow. Get commands use DetailRow for vertical
key-value display. Cluster get also uses DetailRow.

Output branching uses resolve_auto() (now public) to render curated
tables on TTY and pass through JSON/YAML for piped output. JMESPath
queries are applied before table rendering.
joshrotenberg added a commit that referenced this pull request Mar 3, 2026
…761) (#763)

Add #[derive(Tabled)] row structs to all Enterprise list and get
commands, replacing the generic print_as_table() which dumped all JSON
fields uncurated. This matches the Cloud command patterns established
in PR #760.

Row structs added: DatabaseRow, NodeRow, UserRow, RoleRow, AclRow,
ModuleRow, ShardRow, ProxyRow. Get commands use DetailRow for vertical
key-value display. Cluster get also uses DetailRow.

Output branching uses resolve_auto() (now public) to render curated
tables on TTY and pass through JSON/YAML for piped output. JMESPath
queries are applied before table rendering.
joshrotenberg added a commit that referenced this pull request Mar 3, 2026
)

* feat(enterprise): add curated table formatters for list/get commands (#761)

Add #[derive(Tabled)] row structs to all Enterprise list and get
commands, replacing the generic print_as_table() which dumped all JSON
fields uncurated. This matches the Cloud command patterns established
in PR #760.

Row structs added: DatabaseRow, NodeRow, UserRow, RoleRow, AclRow,
ModuleRow, ShardRow, ProxyRow. Get commands use DetailRow for vertical
key-value display. Cluster get also uses DetailRow.

Output branching uses resolve_auto() (now public) to render curated
tables on TTY and pass through JSON/YAML for piped output. JMESPath
queries are applied before table rendering.

* fix(output): standardize table styles and add Cloud ACL formatters

Polishes output formatting consistency across the codebase:
- Replace all Style::rounded()/Style::modern() with Style::blank()
- Add curated table formatters for Cloud ACL commands (rules, roles, users)
- Use output_with_pager where println! was used for table output
- Re-export resolve_auto from cloud utils for format branching
@joshrotenberg joshrotenberg mentioned this pull request Mar 3, 2026
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.

Consistent table and output formatting across Cloud and Enterprise commands

1 participant