Skip to content

Using mangen with a different binary name #5767

Closed Answered by epage
pepa65 asked this question in Q&A
Discussion options

You must be logged in to vote

Unsure as it seems to work for me

#!/usr/bin/env nargo
---
[dependencies]
clap = { version = "4", features = ["derive"] }
clap_mangen = "0.2"
---

use clap::Parser;

#[derive(Parser, Debug)]
struct Cli {
}

fn main() {
    use clap::CommandFactory as _;

    let mut cmd = Cli::command();
    cmd.set_bin_name("something-bizarre");

    let man = clap_mangen::Man::new(cmd);
    let mut buffer: Vec<u8> = Default::default();
    man.render(&mut buffer).unwrap();

    let buffer = String::from_utf8_lossy(&buffer);
    println!("{buffer}");
}
$ ./clap-5767.rs
warning: `package.edition` is unspecified, defaulting to `2021`
   Compiling clap-5767 v0.0.0 (/home/epage/src/personal/dump)
    Finishe…

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@epage
Comment options

epage Oct 7, 2024
Maintainer

Answer selected by pepa65
Comment options

You must be logged in to vote
1 reply
@epage
Comment options

epage Oct 8, 2024
Maintainer

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants