Skip to content

Add xff/format + aligned --summary table with --format=jsonl rows (#86 PR A) - #202

Merged
helly25 merged 1 commit into
mainfrom
feat/summary-aligned-format
Jul 2, 2026
Merged

Add xff/format + aligned --summary table with --format=jsonl rows (#86 PR A)#202
helly25 merged 1 commit into
mainfrom
feat/summary-aligned-format

Conversation

@helly25

@helly25 helly25 commented Jul 2, 2026

Copy link
Copy Markdown
Owner

First of two PRs for #86 (the shared number formatter you flagged). Introduces xff/format and rebuilds --summary on it.

  • format::Int(value, sep) groups digits (1,234,567).
  • format::Table is the reusable column context from the review: AddRow accumulates pre-formatted cells and updates each column's max width; Render() emits them aligned per an Align (left/right) with no trailing whitespace. -ls alignment (feat(datetime): finalize time-format presets (iso8601 family, rfc3339, space, zulu) #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 isn't a regression for scripts.
md     1     56
txt    2  1,239
total  3  1,295

Self-doc: the --summary GlobalFlag summary + kHelpText note 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.sh covers 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|si size units (binary default, decimal opt-in) on this same formatter.

…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
helly25 enabled auto-merge (squash) July 2, 2026 06:09
@helly25
helly25 merged commit e95c52b into main Jul 2, 2026
8 checks passed
@helly25
helly25 deleted the feat/summary-aligned-format branch July 2, 2026 06:14
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant