Add xff/format + aligned --summary table with --format=jsonl rows (#86 PR A) - #202
Merged
Conversation
…rows (#86 PR A) Introduces xff/format, the shared human-output formatter, and rebuilds --summary on it. format::Int groups digits (1,234,567); format::Table is the reusable column context the review asked for -- it accumulates rows of pre-formatted cells, tracks each column's max width as they are added, and Render()s them aligned per an Align (left/right) with no trailing whitespace. -ls alignment (#87) and other tabular output will reuse it. --summary now prints a right-aligned human table by default (label left; grouped count + byte size right-aligned), and honors --format=jsonl to emit one {"group","count","bytes"} object per row -- the machine path, so the aligned default is not a regression for scripts. JsonQuote escapes the group key. Self-documentation: the --summary GlobalFlag summary + kHelpText note the aligned table and the jsonl machine rows. Tests: format_test (Int grouping, PadLeft/Right, Table alignment incl. no-trailing- space); run_test's summary cases now assert the stable jsonl rows; cli/summary_test.sh covers the aligned rendering + jsonl end to end (with exit-code diagnostics). Follow-up PR B adds --human=iec|si size units on this formatter. bazel test //... green (35 tests).
helly25
enabled auto-merge (squash)
July 2, 2026 06:09
This was referenced Jul 2, 2026
helly25
added a commit
that referenced
this pull request
Jul 6, 2026
Remove five stale 'to do' bullets that describe already-implemented work, so TODO.md stops listing done features as open: - Right align numbers in summary -> shipped (#202, #235) - More output control for summary -> shipped (#86, #203, #275) - Align outputs like -ls -> shipped (#205, #206, #207) - Mimetype support -> shipped (#219 -mime) - File type support -> shipped (#262 -lang, #89) Fix the 'Color support' cross-reference that pointed at the removed 'File type support' bullet to name -lang / {lang} / languages.yml directly. Genuinely-open items (Line count {lines} field, per-file hashes, --sort/-j CLI test, histograms #81) are untouched.
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.
First of two PRs for #86 (the shared number formatter you flagged). Introduces
xff/formatand rebuilds--summaryon it.format::Int(value, sep)groups digits (1,234,567).format::Tableis the reusable column context from the review:AddRowaccumulates pre-formatted cells and updates each column's max width;Render()emits them aligned per anAlign(left/right) with no trailing whitespace.-lsalignment (feat(datetime): finalize time-format presets (iso8601 family, rfc3339, space, zulu) #87) and other tabular output will reuse it.--summarynow prints a right-aligned human table by default (label left; grouped count + byte size right-aligned), and honors--format=jsonlto emit one{"group","count","bytes"}object per row - the machine path, so the aligned default isn't a regression for scripts.Self-doc: the
--summaryGlobalFlag summary +kHelpTextnote the aligned table + jsonl rows.Tests:
format_test(Int grouping, PadLeft/Right, Table alignment incl. no-trailing-space);run_test's summary cases assert the stable jsonl rows;cli/summary_test.shcovers the aligned rendering + jsonl end to end (with exit-code diagnostics per the recent flake hardening).bazel test //...green (35 tests).PR B (next) adds
--human=iec|sisize units (binary default, decimal opt-in) on this same formatter.