Skip to content

feat: man page generation, installed automatically by git id init#3

Merged
jmarette merged 2 commits into
masterfrom
feat/man-page
Jun 15, 2026
Merged

feat: man page generation, installed automatically by git id init#3
jmarette merged 2 commits into
masterfrom
feat/man-page

Conversation

@jmarette

Copy link
Copy Markdown
Owner

What

Adds a man page for git-id, generated from the clap definition with clap_mangen (the same source of truth as --help and the shell completions):

  • git id man prints 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 init installs it next to the binary so it works with no extra command: <prefix>/share/man/man1 for a cargo / installer / Homebrew layout (found via man's bin → share/man mapping), ~/.local/share/man as a fallback. uninstall removes it; doctor reports it.

This fixes the long-standing caveat that git id --help — which git rewrites to man git-id — had nothing to open.

Why install via init rather 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, and cargo install never installs man pages. Piggybacking on init — 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-dist man1.install.

Coverage

  • macOS + Linux, via Homebrew / shell installer / cargo install.
  • Windows is a no-op (no man system); git-id --help still works there.

Verification

cargo fmt --check, cargo clippy --all-targets -- -D warnings, and the full test suite (unit + integration, including the new man_dir resolver cases and an end-to-end init → man → uninstall test). Manually confirmed that man git-id and git id --help render the page after git id init in a scratch HOME.

jmarette added 2 commits June 15, 2026 10:04
`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).
@jmarette jmarette merged commit 7a65637 into master Jun 15, 2026
9 checks passed
@jmarette jmarette deleted the feat/man-page branch June 15, 2026 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant