Harmonized table output across commands using tabled - #19
Merged
Merged
Conversation
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.
Every command that printed a table rolled its own, with hardcoded column
widths:
param listpadded names to 30 characters,log listto 30,lpsused a different two-space style,
mem listwasn't columnar at all, anddeck listhad a third variant. A value longer than its hardcoded widthpushed the row out of alignment.
This switches them all to
tabledbehindtwo helpers in
utils::display:table()applies the house style in one place —|separators, a dashed ruleunder the header with
+junctions, columns sized to their content.print_table()prints itwithout trailing whitespace. Rows are described with
#[derive(Tabled)]structs, so the column headers live next to the data instead of in a format
string.
Converted:
param list,param get,log list,mem list,loco display,the anchor-positions file listing, and
deck list(which drops the hand-rolledhelper added in #18).
Deliberately left alone:
test.rs,scan,lighthouseandbootloader infoprint label/value blocks and single-column lists, not tables — forcing those
into a grid would read worse.
The style is unchanged in spirit but columns now fit their content:
mem listis the one visible format change — it used to print[0] EEPROMConfig size=7k (0x1fff/8191)per line.Numeric columns (
mem listID, anchor IDs) are right-aligned andparam'sAccesscolumn stays centred, as before.All
--csvoutput paths are untouched.Dependency
tabledadds 6 crates to a 440-crate tree (tabled,tabled_derive,papergrid,bytecount,fnv,testing_table).unicode-width,syn,quoteandheckwere already present via indicatif/inquire. It also fixesdisplay width for wide characters, which the hand-rolled version got wrong.
Testing
param list,param get,log list,mem listanddeck listverifiedagainst a Crazyflie with a Lighthouse deck attached; the anchor-positions
listing against a file. Empty result sets render as header + rule, as before.
The doc examples in
docs/memory.md,docs/logging.md,docs/parameters.mdand
docs/deck.mdare updated to match the new output.