Skip to content

--human defaults to SI; add --si alias + numeric synonyms - #275

Merged
helly25 merged 1 commit into
mainfrom
feat/human-si-default
Jul 6, 2026
Merged

--human defaults to SI; add --si alias + numeric synonyms#275
helly25 merged 1 commit into
mainfrom
feat/human-si-default

Conversation

@helly25

@helly25 helly25 commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Per your call on #113: human sizes (-ls / --summary) now default to SI (kB/MB, 1000^N)
rather than IEC, since IEC's i reads less human. --human already existed; this flips the default
and rounds out the spellings.

  • Bare --human and the new --si both select SI. The xff/rg style default flips from
    iec to si too.
  • --human=iec (or =1024) selects binary (KiB/MiB); =si (or =1000) decimal;
    =off raw bytes.
  • The renderer already spells each scale correctly - SI kB (lowercase kilo), IEC KiB - and never
    mixes them at one site, which is the core of feat(engine): -printf time directives %a/%c/%t + %Ak/%Ck/%Tk #113.
$ xff --summary=ext .        # xff style, default
txt    2  1.24 kB
$ xff --summary --human=iec .
big.bin  1  5.60 MiB

Scope note (in TODO)

The only unit-suffixed output is the human renderer; the input unit grammars
(-size/-blocks/--block-size, --buffer) stay find-native binary and are never printed with a
suffix, so there's no SI/IEC mismatch to fix there - recorded as a possible later refinement.

Tests

summary_test: default-xff now expects kB; a new case locks bare --human = SI and --si = SI
(decimal MB, no MiB); the iec + precision cases pin --human=iec explicitly. The sizes flavor
facet auto-updates (find=bytes, xff=si, rg=si). bazel test //xff/... green (67).

Human sizes (-ls / --summary) now default to SI (kB/MB, 1000^N) rather than IEC, since IEC's `i`
reads less human. Bare --human and the new --si both select SI; the xff/rg style default flips from
iec to si too. --human=iec (or =1024) still selects binary (KiB/MiB), =si (or =1000) decimal, =off
raw bytes. The renderer already spells each scale correctly (SI kB lowercase, IEC KiB) and never
mixes them at one site.

- ResolveHuman: style default kIec -> kSi; accepts --si, --human=1000 (si), --human=1024 (iec);
  iterates the globals as string_view.
- New --si global (an alias for --human=si); --human summary/display updated (si is the default).
- The `sizes` flavor facet auto-updates (find=bytes, xff=si, rg=si) via HumanName(ResolveHuman()).

Tests: summary_test - the default-xff case now expects kB; a new case locks bare --human = SI and
--si = SI (both decimal MB, no MiB); the iec + precision cases pin --human=iec explicitly. `bazel
test //xff/...` green (67).

#113: input unit grammars (-size/-blocks/--block-size/--buffer) stay find-native binary and are
never printed with a suffix, so there is no SI/IEC mismatch there; documented in TODO as a possible
later refinement (explicit KiB-style input units + --help=size rule).
@helly25
helly25 enabled auto-merge (squash) July 6, 2026 00:27
@helly25
helly25 merged commit 6e885f1 into main Jul 6, 2026
8 checks passed
@helly25
helly25 deleted the feat/human-si-default branch July 6, 2026 00:38
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