Skip to content

Add 'dispatch man' to generate a roff man page#309

Open
jongio wants to merge 1 commit into
mainfrom
idea/man-page
Open

Add 'dispatch man' to generate a roff man page#309
jongio wants to merge 1 commit into
mainfrom
idea/man-page

Conversation

@jongio

@jongio jongio commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Closes #308

Adds a dispatch man subcommand that writes a section-1 roff man page to standard output:

dispatch man > dispatch.1

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:

  • New cmd/dispatch/man.go with runMan and a roff renderer. Content lives in small tables (commands, flags, environment, examples) with a manEscape helper for roff-safe text.
  • Wire man into handleArgs, the usage banner, and the bash, zsh, fish, and powershell completion command lists.
  • cmd/dispatch/man_test.go covers 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 deadcode all clean.

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]>
@jongio jongio added the idea Feature idea from the idea pipeline label Jul 13, 2026
@jongio jongio self-assigned this Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

idea Feature idea from the idea pipeline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add 'dispatch man' to generate a roff man page

1 participant