Repository navigation
Print ls and ls-remote as tables with column headings - #3
Merged
Merged
Conversation
The listings had grown three kinds of line — headings, prose and data —
all at the same weight and indent, so a hint read as another entry and
the sections ran together. The worst of it was "no binary for this
platform" repeated on eight consecutive lines, saying the same thing
each time and filling half the screen.
Both commands now print a table with a heading row, through a shared
`table` module. A heading names what a column holds, which is what lets
the rows stop repeating sentences: that eight-line note is a BINARY
column three characters wide. The `*` marker is gone the same way —
"installed", "latest" and "active" are words in a NOTE column instead of
a symbol to decode.
A column no row fills is dropped, heading and all: `ls-remote --all`
collapses no series, so it shows no OLDER column rather than a heading
over blanks. In `ls`, BUILD and PUBLISHED appear only when a nightly is
installed, since a release is fully identified by its name. Every line
is right-trimmed, so an empty trailing column leaves nothing behind.
The blank line that used to split the release list is gone too. It
separated collapsed series from the expanded one, a distinction OLDER
now states outright, so it had become a gap with no meaning.
Two consequences worth naming:
* the "build from source" hint went missing with the note it used to
trail. It is back as a single line, printed only when BINARY reads
`no` on every row — the one case where the fix is not "install a
different version".
* `group`'s `expanded` flag is no longer read outside the tests, since
the table renders collapsed and expanded rows alike. It stays,
marked, because it is the only thing that separates a collapsed
single-patch series from an individually listed release —
`older_in_series` is 0 for both — and dropping it would weaken the
grouping tests.
Ordering is no longer load-bearing: the newest release had to be the
last line on screen because nothing else identified it, and its row now
says `latest`. So the nightly table sits on top, where it reads best.
Display assertions were rewritten to read a row rather than an exact
substring, since column padding depends on what else is on screen. Adds
a test for `ls`, whose "incomplete" note had never had one.
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.
The listings had grown three kinds of line — headings, prose and data — all at the same weight and indent, so a hint read as another entry and the sections ran together. The worst of it was
no binary for this platformrepeated on eight consecutive lines, saying the same thing each time and filling half the screen.Before
After
What the heading row buys
A heading names what a column holds, which is what lets the rows stop repeating sentences: that eight-line note is a
BINARYcolumn three characters wide. The*marker is gone the same way — "installed", "latest" and "active" are words in aNOTEcolumn instead of a symbol to decode.A column no row fills is dropped, heading and all:
ls-remote --allcollapses no series, so it shows noOLDERcolumn rather than a heading over blanks. Inls,BUILDandPUBLISHEDappear only when a nightly is installed, since a release is fully identified by its name. Every line is right-trimmed, so an empty trailing column leaves nothing behind.The blank line that used to split the release list is gone too. It separated collapsed series from the expanded one, a distinction
OLDERnow states outright, so it had become a gap with no meaning.Two consequences worth naming
BINARYreadsnoon every row — the one case where the fix is not "install a different version".group'sexpandedflag is no longer read outside the tests, since the table renders collapsed and expanded rows alike. It stays, marked, because it is the only thing that separates a collapsed single-patch series from an individually listed release (older_in_seriesis 0 for both), and dropping it would weaken the grouping tests.Ordering is no longer load-bearing: the newest release had to be the last line on screen because nothing else identified it, and its row now says
latest. So the nightly table sits on top, where it reads best.Tests
Display assertions were rewritten to read a row rather than an exact substring, since column padding depends on what else is on screen. Adds a test for
ls, whose "incomplete" note had never had one, and unit tests for the sharedtablemodule (heading widths, dropped columns, trailing whitespace, multi-byte names).53 unit + 46 integration tests,
fmtandclippyclean. Output verified against the real GitHub API, not only mocks.