feat(output): add TableColumn::align for right-aligned table columns - #94
Merged
Conversation
Numeric/price columns render left-aligned today, which reads poorly when values are different widths (decimal points don't line up). Adds an Alignment enum and TableColumn::align builder so a column's header and cells can be right-aligned instead. Fixes DEVEX-1014
There was a problem hiding this comment.
Pull request overview
Adds first-class right/left alignment support for human table output, enabling numeric/price columns to be right-aligned while preserving existing defaults and view behavior across nested tables.
Changes:
- Introduces
Alignment(Left/Right) and aTableColumn::align(Alignment)builder. - Threads column alignment through the human table rendering pipeline (
render_array_with_columns→render_table). - Adds unit + integration coverage for right-aligned tables and documents the new API in concepts docs.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| cli-engine/src/output/human.rs | Adds Alignment, TableColumn::align, and applies alignment during table padding/rendering; includes new unit tests. |
| cli-engine/src/output/mod.rs | Re-exports Alignment from output module. |
| cli-engine/src/lib.rs | Re-exports Alignment at the crate root for public consumption. |
| cli-engine/tests/exhaustive_output.rs | Adds an integration test asserting right-aligned price columns in human output. |
| cli-engine/docs/concepts.md | Documents TableColumn::align(Alignment::Right) and its rendering scope. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Fix "ragging" -> "looking ragged" grammar in the doc comment and concepts.md, and rename the default-alignment test to stop implying it exercises Alignment::Right when it verifies the Left default.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (1)
cli-engine/docs/concepts.md:623
- This bullet is a single very long line, while surrounding bullets are wrapped for readability. Wrapping it to match the local style will keep diffs and future edits easier to scan.
- `TableColumn::align(Alignment::Right)` right-aligns a column's header and cells (the default is `Alignment::Left`) — use it for numeric or price columns so digits and decimal points line up instead of looking ragged on the left. Only affects table rendering; a property-bag `key: value` line has no column width to align against.
qcai-godaddy
approved these changes
Aug 17, 2026
Merged
jpage-godaddy
pushed a commit
that referenced
this pull request
Aug 17, 2026
🤖 I have created a release *beep* *boop* --- <details><summary>cli-engine: 0.8.5</summary> ## [0.8.5](cli-engine-v0.8.4...cli-engine-v0.8.5) (2026-08-17) ### Features * **command:** Add bare group help Json output support ([#78](#78)) ([94444ab](94444ab)) * **output:** add TableColumn::align for right-aligned table columns ([#94](#94)) ([2d2bf27](2d2bf27)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
6 tasks
jpage-godaddy
added a commit
that referenced
this pull request
Aug 18, 2026
…k path (#96) ## Summary - Adds auto-detection to the no-view (dynamic) column catalog used by `render_array`: a field that's a JSON number on every row it appears in (nulls/missing don't disqualify it, but any other value type anywhere does) now renders right-aligned automatically, matching what a registered view gets from `TableColumn::align(Alignment::Right)` (#94). - Registered views are unaffected — they still default to `Alignment::Left` and must opt in explicitly, since a view author may have a numeric-looking column (an opaque ID, say) that shouldn't be right-aligned. - Fixes two existing tests whose expected strings encoded the old left-aligned/ragged numeric output for no-view arrays. - Documents the behavior in `docs/concepts.md`. Fixes [DEVEX-1020](https://godaddy-corp.atlassian.net/browse/DEVEX-1020) ## Test plan - [x] `cargo fmt --all --check` - [x] `cargo clippy --all-targets -- -D warnings` - [x] `cargo test --all-targets` - [x] `RUSTDOCFLAGS='-D warnings' cargo doc --no-deps` - [x] New unit tests: numeric-on-every-row right-aligns, mixed-type column stays left, all-null column stays left - [x] New integration test in `tests/exhaustive_output.rs` reproducing this end-to-end with no registered view 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Alignmentenum (Left/Right, defaultLeft) and aTableColumn::align(Alignment)builder so a column's header and cells can be right-aligned in human table output — useful for numeric/price columns where left alignment leaves decimal points ragged.render_array_with_columns/render_table; nested tables pick it up automatically since they route through the same rendering path.Alignmentfromoutput::modand the crate root alongsideTableColumn.docs/concepts.md.Implements DEVEX-1014
Test plan
cargo fmt --all --checkcargo clippy --all-targets -- -D warningsRUSTDOCFLAGS='-D warnings' cargo doc --no-depscargo test --all-targets(piped, non-TTY width)cargo test --doccargo rustdoc --lib -- -W missing-docs(zero missing docs)src/output/human.rstests/exhaustive_output.rs🤖 Generated with Claude Code