mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-02 18:13:39 +00:00
feat(cli): generate man pages and shell completions (#7071)
Add the man-and-completions example, which writes photocraft-cli's completions for bash, zsh, fish, elvish and PowerShell (clap_complete) and its man pages (clap_mangen: photocraft-cli.1 and one per subcommand, such as photocraft-cli-convert.1) into a directory: cargo run -p photocraft-cli --example man-and-completions -- <out-dir> clap_complete and clap_mangen are dev-dependencies, so the binary is unchanged. clap_mangen gets its env feature, so the pages name each flag's environment variable as --help does; clap already has env, so Cargo.lock gains no package for it. The library exposes only `command()`, the clap definition; the args module stays private. A test runs Command::debug_assert and checks that every shell's completions and every page generate. Another repeats the example's two generate_to calls and pins the exact file list: the five completion files under the names the packages install, photocraft-cli.1, one page per subcommand, and no pages for the help subcommand. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -45,6 +45,8 @@ thiserror = "2"
|
||||
serde = { version = "1", features = ["derive", "rc"] }
|
||||
serde_json = "1"
|
||||
clap = { version = "4", features = ["derive", "env"] }
|
||||
clap_complete = "4.6.11"
|
||||
clap_mangen = { version = "0.3.3", features = ["env"] }
|
||||
arc-swap = "1"
|
||||
bytemuck = { version = "1", features = ["derive"] }
|
||||
flate2 = { version = "1", default-features = false, features = ["rust_backend"] }
|
||||
|
||||
Reference in New Issue
Block a user