Skip to content

feat(datetime): finalize time-format presets (iso8601 family, rfc3339, space, zulu) - #87

Merged
helly25 merged 1 commit into
mainfrom
feat/time-presets
Jun 22, 2026
Merged

feat(datetime): finalize time-format presets (iso8601 family, rfc3339, space, zulu)#87
helly25 merged 1 commit into
mainfrom
feat/time-presets

Conversation

@helly25

@helly25 helly25 commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Refines the FormatTime presets (follow-up to #86) into a consistent scheme - only genuinely-conformant forms carry a standard name:

preset output claim
space (default) 2026-06-22 14:30:00 +0100 none - readable
iso / iso8601 2026-06-22T14:30:00+0100 ISO-8601 extended
iso8601-basic 20260622T143000+0100 ISO-8601 basic
rfc3339 2026-06-22T14:30:00+01:00 RFC 3339
asctime Mon Jun 22 14:30:00 2026 asctime(3); find default
zulu / zulu-dense …Z / 20200913T122640Z UTC (force)
epoch 1600000000 Unix seconds

Changes vs #86: drop the redundant find alias (it is just asctime); rename iso -> iso8601 (keep iso as a shorthand alias, shared const); add iso8601-basic, zulu, zulu-dense; space gains a space before the offset. The no-flag modern default is space; find/strict mode will default to asctime (mode system, #54).

Green on default + --config=clang --config=asan (12/12); clang-format + no-em-dash clean.

…, space default, zulu)

Refines the FormatTime presets per review into a consistent scheme where only genuinely-conformant forms carry a standard's name:
- iso8601 (+ iso alias) - ISO-8601 extended, T: 2026-06-22T14:30:00+0100
- iso8601-basic - ISO-8601 basic/compact: 20260622T143000+0100
- rfc3339 - RFC 3339, colon offset: 2026-06-22T14:30:00+01:00
- space (no-flag default) - readable, claims no standard, space before the offset: 2026-06-22 14:30:00 +0100
- asctime - asctime(3); the find default %t
- zulu / zulu-dense - UTC with a Z designator, extended / compact (force UTC)
- epoch - Unix seconds

Drops the redundant find alias (it is just asctime) and renames iso -> iso8601 with iso kept as a shorthand alias. The modern default is space (human-readable); find/strict mode defaults to asctime via the mode system (#54). Tests cover every preset, the iso alias, the space offset spacing, and zulu forcing UTC (UTC for determinism).
@helly25
helly25 enabled auto-merge (squash) June 22, 2026 23:07
@helly25
helly25 merged commit 8eda22a into main Jun 22, 2026
5 checks passed
@helly25
helly25 deleted the feat/time-presets branch June 22, 2026 23:10
helly25 added a commit that referenced this pull request Jun 22, 2026
…efault decision (#88)

Follow-up to #87. Adds iso8601-full (ISO-8601 with sub-second precision: 2026-06-22T14:30:00.000000000+0100) and human as an alias of the space readable default (both via shared consts, the alias fashion).

Drops the considered sql alias: the SQL TIMESTAMP WITH TIME ZONE form uses a colon offset with no leading space (2026-06-22 14:30:00+01:00), so our space form (+0100, space before the offset) is not exactly SQL - same honesty rule as not over-claiming ISO.

Adds TODO.md to track open cross-cutting decisions; first entry is whether the modern (non-find) default should stay space or become rfc3339 (revisit before v1 / with the mode system #54).
helly25 added a commit that referenced this pull request Jul 2, 2026
…rows (#86 PR A) (#202)

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 added a commit that referenced this pull request Jul 2, 2026
#205)

The reusable mechanism for aligning tabular output that arrives row by row (e.g.
-ls, which emits per entry during the walk). Buffers up to `window` rows to compute
per-column widths, emits that block aligned, then streams later rows at those widths
-- growing a column when a wider cell appears. window==0 disables buffering (each row
at the fixed minimum widths, no cross-row alignment); window==kAll buffers all (full
alignment on Flush). Backs -ls's coming --buffer=auto|off|all|N.

Factors the per-row padding out of Table::Render into a shared RenderPaddedRow so
Table and ColumnBuffer align identically (two-space gaps, right-most cell not
right-padded -> no trailing whitespace).

Pure lib, no CLI surface yet; PR B wires -ls through it + the --buffer flag. Tests
cover buffer-all, the window flush-then-stream-and-grow path, and off-at-min-widths.
bazel test //xff/format green.
helly25 added a commit that referenced this pull request Jul 2, 2026
…PR B) (#206)

-ls now emits aligned columns instead of single-space-joined text. LsCells exposes
the entry's -ls columns (inode, 1K blocks, perms, nlink, owner, group, size, time,
path) and LsColumns the per-column alignment + minimum widths (ls -l-like floors:
owner/group/size 8, perms fixed 10, path 0; numeric columns right-aligned). The
driver feeds each row to a format::ColumnBuffer and flushes the remainder after the
walk; EvalContext.emit_ls_row carries the cells (empty -> the single-spaced LsRecord
fallback, kept for -fls and in-process callers).

--buffer=auto|off|all|N controls it: auto (default) buffers the first 100 rows to
size columns then streams at frozen widths; off uses the minimum widths unbuffered;
all buffers the whole run; N buffers the first N. ResolveBufferWindow parses it.

Self-documentation: --buffer GlobalFlag (Output) + kHelpText.

Sizes stay raw bytes here (find -ls-compatible); the xff human-size default is the
next PR (unifying --human across -ls and --summary). Tests: cli/ls_test.sh (lists +
perms, column alignment via equal path-prefix width, off/all/N accepted, --help
topic); existing -ls unit tests still pass. bazel test //... green (36 tests).
helly25 added a commit that referenced this pull request Jul 2, 2026
… C) (#207)

Unifies size rendering across -ls and --summary on one policy: --human=iec|si|off,
style-defaulted. Unset means the xff style shows human sizes (iec: KiB/MiB) while the
find style shows raw bytes (find -ls compatibility); --human=off forces bytes
anywhere, =si is decimal (kB/MB). --format=jsonl stays raw bytes regardless (the
machine path).

- run.cc: ResolveHuman gains the style (xff -> iec default) and an =off value; its
  result now also feeds -ls via EvalContext.ls_size_units.
- evaluate: LsCells takes the size units and renders the size cell via format::Size
  (or raw bytes when nullopt); EvalLs passes ctx.ls_size_units, the LsRecord fallback
  stays bytes.

This is why the -ls size column is naturally narrow/uniform (5.6 MiB, 56 B), which
also keeps the aligned columns tidy. Self-doc: --human display/summary updated (globals
+ kHelpText). summary_test.sh now asserts the human default + a --human=off byte case.
Completes #87. bazel test //... green (36 tests).
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