Skip to content

cli: xff --man generates the man page from the registry + globals SOTs - #190

Merged
helly25 merged 1 commit into
mainfrom
feat/man-page
Jun 28, 2026
Merged

cli: xff --man generates the man page from the registry + globals SOTs#190
helly25 merged 1 commit into
mainfrom
feat/man-page

Conversation

@helly25

@helly25 helly25 commented Jun 28, 2026

Copy link
Copy Markdown
Owner

xff --man renders a roff(1) man page on demand from the same single sources of truth the parser and --help use - cli::Globals() for options, registry::All() for the expression vocabulary - so the page can't drift from the binary. NAME/SYNOPSIS/DESCRIPTION, OPTIONS grouped like the usage page, EXPRESSION by kind, EXIT STATUS, SEE ALSO; xff-only items tagged "(xff extension)". Pipe to man -l -.

ArgHint moves out of help.cc's anonymous namespace to a declared helper so the man page and --help render the primary synopsis from one grammar source (no duplication).

Tests + the tool-dependency decision

  • manpage_test (unit): standard man sections, option/expression subsections, every global + primary documented, xff items marked.
  • man_test (bashtest): renders xff --man through a real roff formatter (mandoc/groff/nroff) and asserts a proper page with no leftover roff control requests - which caught a .B-left-mid-line bug during development.

Per our discussion, the formatter is a required test dependency (no skip): mandoc ships on macOS and CI installs it on Linux (added to the test matrix + tsan jobs). A missing formatter fails the test - it can never be silently skipped, so there's no skip-collection machinery to maintain. (bashtest has no per-test skip primitive anyway; its SKIP tally is filter-only.)

Verified: full bazel test //... green; mandoc render checked locally; actionlint/yamllint/shfmt/shellcheck + pinned clang-format clean.

A roff(1) man page rendered on demand from the same single sources of truth
the parser and --help use -- cli::Globals() for options, registry::All() for
the expression vocabulary -- so the page can never drift from the binary.
NAME/SYNOPSIS/DESCRIPTION preamble, OPTIONS grouped like the usage page,
EXPRESSION grouped by kind, EXIT STATUS, SEE ALSO; xff-only items tagged
"(xff extension)". Wired to `--man` (print and exit). Pipe to `man -l -`.

ArgHint moves from help.cc's anonymous namespace to a declared helper so the
man page and --help render the primary synopsis from the one grammar source
(no duplication).

Tests:
- manpage_test (unit): the standard man sections, the option/expression
  subsections, every global + primary documented, xff items marked.
- man_test (bashtest): renders `xff --man` through a real roff formatter
  (mandoc/groff/nroff) and asserts a proper page with no leftover roff control
  requests (which caught a `.B`-left-mid-line bug during development). The
  formatter is a REQUIRED test dependency -- mandoc ships on macOS and CI
  installs it on Linux (test + tsan jobs); a missing formatter fails the test,
  it is never silently skipped.
@helly25
helly25 enabled auto-merge (squash) June 28, 2026 12:46
@helly25
helly25 merged commit 385150a into main Jun 28, 2026
8 checks passed
@helly25
helly25 deleted the feat/man-page branch June 28, 2026 12:51
helly25 added a commit that referenced this pull request Jul 12, 2026
mbo 0.13.0 is now in the Bazel Central Registry, so drop the temporary
git_override (pinned at the main commit merging helly25/mbo#234) for a plain
bazel_dep version bump. 0.13.0 carries mbo/diff (the rich diff API behind -diff,
#88) and mbo/digest (the -hash algorithms, #105), which the override provided;
it also keeps the macOS clang+asan verification (#188) and StatusIs code-matcher
support (#190) our test conventions rely on. Comment refreshed to match.

Test: bazel test //xff/cli:hash_test //xff/cli:diff_test //xff/examples:cookbook_test
(mbo/digest + mbo/diff + smoke) pass against the BCR 0.13.0; pre-commit green.
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