Add 'dispatch man' to generate a roff man page#309
Open
jongio wants to merge 1 commit into
Open
Conversation
Add a 'man' subcommand that writes a section-1 roff man page to stdout so
packagers and users can install offline docs:
dispatch man > dispatch.1
The page mirrors the built-in usage banner (name, synopsis, description,
commands, flags, environment, examples). Wire 'man' into handleArgs, the
usage banner, and all four shell completion command lists.
Also fix TestPrintUsage_Output, which redirected stdout to an OS pipe and
only read it after the write finished. Once the help text passed the
Windows pipe buffer (~4 KB) the write blocked and the test deadlocked.
Drain the pipe on a goroutine so output size can no longer stall it.
Co-authored-by: Copilot App <[email protected]>
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 #308
Adds a
dispatch mansubcommand that writes a section-1 roff man page to standard output:The page mirrors the usage banner (name, synopsis, description, commands, flags, environment, examples) so packagers get offline docs without hand-maintaining a second copy.
Changes:
cmd/dispatch/man.gowithrunManand a roff renderer. Content lives in small tables (commands, flags, environment, examples) with amanEscapehelper for roff-safe text.manintohandleArgs, the usage banner, and the bash, zsh, fish, and powershell completion command lists.cmd/dispatch/man_test.gocovers roff structure, command coverage, escaping, and the handleArgs case.Also fixes
TestPrintUsage_Output: it redirected stdout to an OS pipe and read it only after the write returned. Once the help text passed the Windows pipe buffer (about 4 KB) the write blocked and the test deadlocked. The pipe is now drained on a goroutine so output size cannot stall it.Verified:
go build ./...,go vet ./...,go test ./...,golangci-lint run,mage deadcodeall clean.