How to Create Man Pages for Rust CLI Applications

Cli
Generate man pages for Rust CLI apps using the mdbook-man crate or clap's built-in support to output standard Unix help files.

Use the mdbook-man crate to generate man pages from your Rust CLI's clap or argh configuration. Add the dependency to your Cargo.toml, then run the build command to output the man page file.

[dependencies]
mdbook-man = "0.1"
cargo run --bin your-cli -- --man-page

Alternatively, if using clap, enable the derive feature and run:

cargo install mdbook-man
cargo run --bin your-cli -- --help | mdbook-man > your-cli.1