Add man page generation from the command-line model#2
Merged
Conversation
Add CommandSet.OutputManPage (string and file overloads), a ManPageInfo type for document-level metadata, a reference ManPage feature invoked as a man command, and UserInput.FormatManPage which reuses FormatFlags so the page cannot drift from --help. Output uses only portable man(7) macros and validates warning-free under groff and mandoc -T lint. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
mnadareski
reviewed
Jul 1, 2026
Rename the man page API to the single-word "Manpage" spelling throughout (Manpage feature, ManpageInfo, CommandSet.OutputManpage, UserInput.FormatManpage) for consistency with the "manpage" convention. - Drop the redundant null check in OutputManpage; info is non-nullable under the enabled nullable context. - Move the tests that exercise CommandSet.OutputManpage into CommandSetTests as a "Manpage Output" region, and relocate the Manpage feature test into a path-synced Features subfolder (SabreTools.CommandLine.Test.Features). Private test helpers now sit at the bottom of their classes. - Fix the Manpage feature doc example to use the actual "man" command. Builds clean across all target frameworks; the 235 tests pass and the generated page still validates warning-free under groff -man -ww and mandoc -T lint. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1.
This adds a roff/man page output path built from the existing command-line
model, so a consuming CLI can emit a man page whose content matches
--help,generated from one source instead of a hand-maintained
.1.Following the issue discussion:
CommandSet.OutputManPage(ManPageInfo, bool includeVerbose)returns the pageas a string. An overload
OutputManPage(string path, ManPageInfo, bool)writesit to a file and calls the string version.
ManPageInfocarries the data themodel does not: name, section, date, version, title, short description, and the
options heading.
Features.ManPagemirrorsHelpandHelpExtended: ittakes the enclosing
CommandSetand writes the page to standard output. It isinvoked as a
mancommand (e.g.tool man > tool.1) and wired intoCommandSet.ProcessArgsalongside the other reference features. The commandname is overridable through the alternate constructor.
includeVerboseechoesHelpExtended: when set, each input's detaileddescription is included. It defaults to true for the reference feature.
Per-input rendering lives on
UserInput(FormatManPage) so it reusesFormatFlags(). The flag column stays identical to--help, so the page cannotdrift from the help text.
CommandSetbuilds the document skeleton anddelegates, mirroring how
OutputAllHelpdelegates toFormatRecursive.Output is restricted to the portable man(7) macro set. It validates warning-free
under
groff -ww -mandocand undermandoc -T lint. The.THdate is leftblank by default for the packager to stamp; mandoc emits a single "missing date"
warning in that case, which clears once a date is supplied.
Notes:
repository. The
.editorconfigcharset = utf-8and the committed filescurrently disagree repo-wide, which I left untouched.
Prepared with AI assistance (Claude Opus 4.8) and reviewed before submission.