Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Man page synopsis doesn't use the bin_name #4757

Open
2 tasks done
arusahni opened this issue Mar 11, 2023 · 3 comments · May be fixed by #4758
Open
2 tasks done

Man page synopsis doesn't use the bin_name #4757

arusahni opened this issue Mar 11, 2023 · 3 comments · May be fixed by #4758
Labels
A-man Area: man generator C-bug Category: Updating dependencies

Comments

@arusahni
Copy link

Please complete the following tasks

Rust Version

1.67.1

Clap Version

4.1.8

Minimal reproducible code

use clap::{arg, CommandFactory, Parser};
use clap::CommandFactory;
use clap_mangen::Man;

#[derive(Debug, Parser)]
#[command(
    bin_name = "myapp",
)]
struct Cli {
   #[arg(long)]
    list: bool
}

fn main() {
    let cmd = Cli::comand();
    let man = Man::new(cmd);
    let mut buffer: Vec<u8> = Default::default();
    man.render(&mut buffer)?;
    Ok(())
}

Steps to reproduce the bug with the above code

cargo run

Actual Behaviour

The generated manpage has a synopsis section that uses the Crate name for the sample invocation:

SYNOPSIS
       appname [--list]

Expected Behaviour

The generated manpage should have synopsis section that uses the provided bin_name for the sample invocation:

SYNOPSIS
       myapp [--list]

Additional Context

No response

Debug Output

No response

@arusahni arusahni added the C-bug Category: Updating dependencies label Mar 11, 2023
@arusahni arusahni changed the title Man page synopsis Man page synopsis doesn't use the bin_name Mar 11, 2023
@epage epage added the A-man Area: man generator label Mar 13, 2023
@epage
Copy link
Member

epage commented Mar 13, 2023

Is there a reason you are setting bin_name and not name or display_name?

@arusahni
Copy link
Author

Yes: I'm writing a git extension. By convention, git extensions are discovered by naming the binary git-<extension name>, but invoked as a git subcommand (git <extension name>). Ultimately, I'd like to reflect this nuance on the manpage, with the displayed name being git-<extension name>, but the synopsis showing git <extension name>.

name doesn't suit my need here because I don't want the subcommand variant displayed throughout the manpage, just places where an invocation example is provided. display_name does not currently impact the synopsis (my PR updates it to be considered, but with lower precedence than the bin_name).

@epage
Copy link
Member

epage commented Mar 20, 2023

Thanks for the explanation!

I think its reasonable then for this to go forward if we can find a way to make this work out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-man Area: man generator C-bug Category: Updating dependencies
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants