feat: man page generation, installed automatically by git id init#3
Merged
Conversation
`git-id man` renders the page from the clap definition (clap_mangen) — the same source of truth as --help and the shell completions. `git id init` installs it next to the binary (<prefix>/share/man/man1, or ~/.local/share/man as a fallback), so `man git-id` and `git id --help` (which git rewrites to `man git-id`) work with no extra step. `uninstall` removes it, `doctor` reports it, and it is a no-op on Windows, which has no man pages. The install target is resolved by a pure cfg!(windows)-gated `man_dir`, unit-tested on every host like the other cross-platform helpers; `Env::data_base()` is factored out and shared with `completions`.
Add a `git id man` row to the commands table and rewrite the caveat: the page is installed by `git id init`, so `git id --help` works (Windows has no man pages).
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.
What
Adds a man page for git-id, generated from the clap definition with
clap_mangen(the same source of truth as--helpand the shell completions):git id manprints the page (roff) — the idiomatic primitive a packager installs, e.g. ripgrep's Homebrew formula does(man1/"rg.1").write \rg --generate man``.git id initinstalls it next to the binary so it works with no extra command:<prefix>/share/man/man1for a cargo / installer / Homebrew layout (found viaman'sbin → share/manmapping),~/.local/share/manas a fallback.uninstallremoves it;doctorreports it.This fixes the long-standing caveat that
git id --help— which git rewrites toman git-id— had nothing to open.Why install via
initrather than the packager?The idiomatic path is for the packager to install the page, but cargo-dist's generated Homebrew formula installs the binary only (unknown files land in
pkgshare, off the manpath) and is force-pushed each release, andcargo installnever installs man pages. Piggybacking oninit— the one-time setup every user runs — is the only channel-independent way to get zero-config man pages today. The proper long-term fix is an upstream cargo-distman1.install.Coverage
cargo install.git-id --helpstill works there.Verification
cargo fmt --check,cargo clippy --all-targets -- -D warnings, and the full test suite (unit + integration, including the newman_dirresolver cases and an end-to-end init → man → uninstall test). Manually confirmed thatman git-idandgit id --helprender the page aftergit id initin a scratch HOME.