feat(output): add TableColumn::align for right-aligned table columns - #94
Open
jpage-godaddy wants to merge 2 commits into
Open
feat(output): add TableColumn::align for right-aligned table columns#94jpage-godaddy wants to merge 2 commits into
jpage-godaddy wants to merge 2 commits into
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.
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