Skip to content

engine: traversal-option synonyms -mount/-x (=-xdev), -d (=-depth) - #153

Merged
helly25 merged 1 commit into
mainfrom
feat/traversal-synonyms
Jun 27, 2026
Merged

engine: traversal-option synonyms -mount/-x (=-xdev), -d (=-depth)#153
helly25 merged 1 commit into
mainfrom
feat/traversal-synonyms

Conversation

@helly25

@helly25 helly25 commented Jun 27, 2026

Copy link
Copy Markdown
Owner

find-flavor union (#148): -mount (GNU/BSD) and -x (BSD) = -xdev; -d (BSD/GNU) = -depth. Wired into ScanDepthOptions; evaluate true as positional options. //... + asan green.

…depth)

find-flavor union (docs/design-find-flavors.md): -mount (GNU/BSD) and -x
(BSD) are synonyms for -xdev; -d (BSD/GNU) is the short spelling of
-depth. All wire into ScanDepthOptions and evaluate true as positional
options. Tested: accepted on a single-device tree (same set) and -d
post-order.
@helly25
helly25 force-pushed the feat/traversal-synonyms branch from 48bba82 to 62b61f9 Compare June 27, 2026 18:04
@helly25
helly25 enabled auto-merge (squash) June 27, 2026 18:04
@helly25
helly25 merged commit afd0ac5 into main Jun 27, 2026
8 checks passed
@helly25
helly25 deleted the feat/traversal-synonyms branch June 27, 2026 18:17
helly25 added a commit that referenced this pull request Aug 6, 2026
… (#384)

* Add indent-aware word-wrap engine to the plain help backend (#153/#164)

PlainTextBackend gains an optional wrap width (default 0 = no wrap, so
--help=fields stays byte-identical). Flowing text - prose, bullets, an
entry summary, a see-also note - routes through a new WrapText helper that
greedily packs words to the width and carries each block's indent onto its
continuation lines (the budget is per-indent-level). Example blocks and the
aligned row table keep their verbatim layout. A word wider than the budget
takes its own line unbroken.

mbo has no wrapping helper to reuse; WrapText is a small local addition. The
--width flag that drives this (TTY width, else 80 fallback) is the next slice.

* Extract WrapText into its own xff/cli/wrap fileset

The word-wrap engine is general functionality, not plain-backend-internal:
give it its own wrap.{h,cc,_test.cc} lib. plain_backend depends on :wrap_cc
and consumes WrapText; its own test drops the WrapText cases (now wrap_test).
No behavior change - the same engine, homed correctly.
helly25 added a commit that referenced this pull request Aug 7, 2026
/#164/#154) (#385)

* Add --width flag + help-width resolver, wired into model-rendered topics

New xff/cli/help_width lib: ResolveHelpWidth (pure, tested) maps the --width
value + detected terminal width to a wrap column; DetectTerminalWidth reads
$COLUMNS / the tty winsize. --width[=auto|none|COLS] is registered in globals
(auto = terminal width else 80; none/0 = no wrap; N = fixed). main resolves it
once and threads it into the model-rendered help topics (--help=fields, etc.)
via PlainTextBackend(width).

NOTE: bare --help and --help=FLAG still render through the imperative RenderHelp
path, which ignores --width; those wrap once that path is ported onto the help
model (the remaining help-epic piece).

* Hold render context (width/color) on the HelpBackend base; wrap rows

Introduce HelpRenderContext { width, color } held by the abstract HelpBackend
base as a constant, so every backend and the walk read one shared context via
Context() - not a bare width param on PlainTextBackend. main resolves it once
at the CLI boundary and threads a HelpRenderContext through the model-rendered
topics. color is plumbed (resolved later; ANSI emission is a follow-up).

Also make EmitRows wrap the description column with a hanging indent under the
description column when a width is set (the aligned vocabulary tables were the
one flowing element that did not wrap); width 0 keeps the verbatim table.

Supersedes the bare-width wiring from the previous commit. Groundwork for
retiring the imperative RenderHelp onto the model.

* Add a general Entry.tags list to the help model (port groundwork)

The model Entry gains a tags vector (parenthesized classification tokens, e.g.
{global, xff} for a flag). All three backends render it as "(a, b, c)" after
the term, falling back to the bare xff marker when tags is empty - so output is
byte-identical until BuildReference populates tags. Groundwork for retiring
RenderHelp: the (global, xff|find) flag tag and the primary kind/style/safety
tags move into the model so every renderer shows them uniformly.

* Enrich model flag/primary entries with tags + influence + not-built note

BuildReference now builds flags via FlagEntry and primaries via PrimaryEntry,
populating Entry.tags ((global, xff|find) / (kind, xff|find, [safety])), a
"not built into this binary" note when a flag's build extra is absent, and the
Affects / Affected-by influence detail lines (ported from help.cc's AffectsList
/ AffectedBy). Since BuildReference is the one SOT for --man / --markdown /
XFF.md, all three gain these uniformly (decision A); XFF.md regenerated and the
two tag unit tests updated. Groundwork for routing --help onto the model.

* Render --help=FLAG/PRIMARY and --help=full from the model (wrap via width)

RenderTopic now resolves a single primary/flag via the new EntryReference (the
same model entry BuildReference folds in) and renders it through
PlainTextBackend(context), so --help=--width, --help=-regex, etc. wrap. --help=full
renders the whole BuildReference() Document plain (the --man/--markdown content in
text). RenderHelp's single-entry branch is retired (returns NotFound); RenderTopic
runs RenderHelp's special topics first (so --help=config beats the --config flag),
then EntryReference. help_render_test's single-entry cases move to a RenderEntry
helper over the model.

Also: --width default is now no-wrap when the terminal width is unknown (a pipe /
file stays full-width and byte-stable; a real terminal still wraps), reverting the
80-column fallback. A title-less section renders headless (the single-entry doc).

* Structured, wrapping, indented Examples section (retire the verbatim blob)

The cookbook recipes are now the shared SOT (CookbookRecipes() in help.h): the
Examples section is built as structured model nodes - each recipe a subsection
with its command as a verbatim Example and its explanation as wrapping Prose -
instead of one preformatted RenderHelp("cookbook") blob. So the explanations
wrap to --width and --man/--markdown get real headings + fenced commands (#152).
The plain backend now indents subsection body content (an example's command and
note sit under their recipe heading).

Fixes a segfault: the recipe struct/accessor were duplicated (an anon-namespace
Recipe shadowed the header type and CookbookRecipes had internal linkage), so
BuildExamples called an undefined public symbol. Recipe + CookbookRecipes are
now the single public definitions. XFF.md regenerated; help_topic_test updated.

* Consistent nesting indentation in plain help + min wrap width (40)

The plain backend now tracks one nesting depth: every Begin* (section, subsection,
entry) indents its body two spaces and the matching End* dedents, so a heading
visibly owns the content beneath it (EXIT STATUS / SEE ALSO / Examples bodies, an
option under its group, an entry's summary/detail under its term) instead of
everything sitting flush-left. Rows, bullets, examples, prose and see-also all
render at the current body indent.

--width also clamps any positive width up to a 40-column minimum (below that,
wrapping degenerates); 0 / none (no wrap) is exempt. The doc-render golden is
updated; markdown / roff are unaffected (XFF.md unchanged).

* Render --help=printf/time/size/grammars from the model (wrap + indent)

The sub-vocabulary topics now render through TopicReference + PlainTextBackend
(the same VocabSection BuildReference folds into the full reference, factored into
named builders so they cannot drift), so they wrap to --width and pick up the
consistent nesting indentation. Retires the imperative RenderPrintfDocs /
RenderTimeDocs / RenderSizeDocs / RenderRegexDocs / RenderFieldsDocs (and drops
the now-unused datetime dep from the cli binary).

* Render bare --help (usage page) from the model in entry style

BuildUsage() renders the description, the whole-run options and expression
primaries as summary-only entries (no detail blocks), and the meta/doc flags +
--help=TOPIC index - all wrapping + indenting via the render context, replacing
the imperative kHelpText / kHelpTextExpression / RenderOptions path. The Options
and Expression section builders are factored so BuildReference and BuildUsage
share one definition (a with_details flag selects the terse vs full form). The
not-built-extra note shows even on the usage page. help_test / extras_test
updated to the model output.

* Render --help=list/all/expressions from the model (wrap + indent)

IndexReference routes the index topics through the shared section builders:
list = the usage page, all = every option + primary (summaries), expressions =
the primaries (summaries) without the global flags. They wrap + indent via the
context instead of the imperative RenderIndex / RenderFull / RenderExpressions.

* Format
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