Add man page generation for trufflehog#4894
Merged
Merged
Conversation
980810c to
bf2448e
Compare
Add a hidden --generate-man-page flag that uses an enhanced Kingpin template to produce a standards-compliant roff man page. The man page includes auto-generated OPTIONS and COMMANDS sections (synced with the CLI definitions), plus hand-maintained EXAMPLES, EXIT STATUS, ENVIRONMENT, FILES, BUGS, and SEE ALSO sections. The DESCRIPTION and EXAMPLES sections call out the interactive TUI that launches when trufflehog is run without a command in a terminal. To keep the generated output deterministic, the --concurrency flag is defined with a static "N" placeholder; the runtime.NumCPU() default is applied at runtime instead of at flag-definition time. The usage line also uses the lowercase binary name. Distribution: - Makefile `man` target to regenerate locally - GoReleaser before hook to regenerate at release time with the correct version injected via ldflags - Release archives explicitly include LICENSE, README.md, and docs/man/trufflehog.1 - Homebrew formula installs the man page to man1 The Makefile `test-release` target is also updated to GoReleaser v2 flag syntax (--skip=publish,sign), which is needed for the snapshot release to succeed locally without cosign installed. Made-with: Cursor
Add a CI job that regenerates the man page on every PR and fails if the checked-in copy at docs/man/trufflehog.1 is out of date with the current CLI definitions. Document the regeneration workflow in CONTRIBUTING.md so contributors know to run `make man` and commit the result when changing flags or subcommands. Made-with: Cursor
bf2448e to
77ac44c
Compare
7 tasks
jainlakshya
pushed a commit
to jainlakshya/trufflehog_revisions
that referenced
this pull request
May 4, 2026
* Add man page generation for trufflehog Add a hidden --generate-man-page flag that uses an enhanced Kingpin template to produce a standards-compliant roff man page. The man page includes auto-generated OPTIONS and COMMANDS sections (synced with the CLI definitions), plus hand-maintained EXAMPLES, EXIT STATUS, ENVIRONMENT, FILES, BUGS, and SEE ALSO sections. The DESCRIPTION and EXAMPLES sections call out the interactive TUI that launches when trufflehog is run without a command in a terminal. To keep the generated output deterministic, the --concurrency flag is defined with a static "N" placeholder; the runtime.NumCPU() default is applied at runtime instead of at flag-definition time. The usage line also uses the lowercase binary name. Distribution: - Makefile `man` target to regenerate locally - GoReleaser before hook to regenerate at release time with the correct version injected via ldflags - Release archives explicitly include LICENSE, README.md, and docs/man/trufflehog.1 - Homebrew formula installs the man page to man1 The Makefile `test-release` target is also updated to GoReleaser v2 flag syntax (--skip=publish,sign), which is needed for the snapshot release to succeed locally without cosign installed. Made-with: Cursor * Add man page maintenance guardrails Add a CI job that regenerates the man page on every PR and fails if the checked-in copy at docs/man/trufflehog.1 is out of date with the current CLI definitions. Document the regeneration workflow in CONTRIBUTING.md so contributors know to run `make man` and commit the result when changing flags or subcommands. Made-with: Cursor
MuneebUllahKhan222
pushed a commit
that referenced
this pull request
May 29, 2026
* Add man page generation for trufflehog Add a hidden --generate-man-page flag that uses an enhanced Kingpin template to produce a standards-compliant roff man page. The man page includes auto-generated OPTIONS and COMMANDS sections (synced with the CLI definitions), plus hand-maintained EXAMPLES, EXIT STATUS, ENVIRONMENT, FILES, BUGS, and SEE ALSO sections. The DESCRIPTION and EXAMPLES sections call out the interactive TUI that launches when trufflehog is run without a command in a terminal. To keep the generated output deterministic, the --concurrency flag is defined with a static "N" placeholder; the runtime.NumCPU() default is applied at runtime instead of at flag-definition time. The usage line also uses the lowercase binary name. Distribution: - Makefile `man` target to regenerate locally - GoReleaser before hook to regenerate at release time with the correct version injected via ldflags - Release archives explicitly include LICENSE, README.md, and docs/man/trufflehog.1 - Homebrew formula installs the man page to man1 The Makefile `test-release` target is also updated to GoReleaser v2 flag syntax (--skip=publish,sign), which is needed for the snapshot release to succeed locally without cosign installed. Made-with: Cursor * Add man page maintenance guardrails Add a CI job that regenerates the man page on every PR and fails if the checked-in copy at docs/man/trufflehog.1 is out of date with the current CLI definitions. Document the regeneration workflow in CONTRIBUTING.md so contributors know to run `make man` and commit the result when changing flags or subcommands. Made-with: Cursor
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.
Summary
Adds a man page for
trufflehogand wires it into the build, release, and Homebrew distribution.The man page is generated from a hidden
--generate-man-pageflag using an enhanced Kingpin roff template. The auto-generatedOPTIONSandCOMMANDSsections stay in sync with the CLI definitions inmain.go;EXAMPLES,EXIT STATUS,ENVIRONMENT,FILES,BUGS, andSEE ALSOare hand-maintained inmanpage.go. TheDESCRIPTIONandEXAMPLESsections also document the interactive TUI.What's included
Feature (commit 1)
manpage.go— enhanced roff template +--generate-man-pageregistrationmain.go— registers the flag; uses the lowercase binary name in usage; defines--concurrencywith a staticNplaceholder and applies theruntime.NumCPU()default at runtime so the generated man page is deterministicMakefile—make manregeneratesdocs/man/trufflehog.1locally;test-releaseupdated to GoReleaser v2 flag syntax.goreleaser.yml—beforehook regenerates the man page with the release version injected via ldflags; release archives explicitly includeLICENSE,README.md, and the man page; Homebrew formula installs toman1docs/man/trufflehog.1— checked-in generated output (showsdevlocally; GoReleaser injects the real version at release time)Maintenance guardrails (commit 2)
.github/workflows/lint.yml—man-page-stalenessjob runsmake manon every PR and fails ifdocs/man/trufflehog.1is out of date with the current CLICONTRIBUTING.md— short note pointing contributors atmake manwhen they change flags or subcommandsTest plan
make manproducesdocs/man/trufflehog.1matching the checked-in copy byte-for-byteman ./docs/man/trufflehog.1renders cleanly (one expected cosmeticWARNING: missing datefrommandoc -T lint)CGO_ENABLED=0 go build .succeeds;--versionand--helpwork as before--generate-man-pageis hidden from--helpand--help-longmake test-release(goreleaser release --clean --skip=publish,sign --snapshot) succeeds and the resulting archives include the man page:dist/homebrew/trufflehog.rbinstalls the man page (oneman1.installline per platform/arch is expected):brew install trufflesecurity/trufflehog/trufflehog && man trufflehogMade with Cursor
Note
Medium Risk
Mostly build/release/CI wiring plus a small behavioral change to
--concurrencydefaulting when unset/invalid; risk is primarily around packaging/release failures or unexpected concurrency behavior changes.Overview
Adds a generated
trufflehog(1)man page via a hidden--generate-man-pageflag (newmanpage.go) and checks in the generated output atdocs/man/trufflehog.1.Wires man-page generation into developer workflow and distribution:
make man, a CI staleness check job inlint.yml, and GoReleaser hooks/packaging so release archives and the Homebrew formula installdocs/man/trufflehog.1.Makes small CLI tweaks to support deterministic docs generation, including using lowercase app name/help text and moving
--concurrency’s defaulting to runtime (while leaving the man page placeholder stable).Reviewed by Cursor Bugbot for commit 77ac44c. Bugbot is set up for automated code reviews on this repo. Configure here.