Skip to content

Commit

Permalink
fix(mangen): Prefer the bin_name for the synopsis
Browse files Browse the repository at this point in the history
Use the user-supplied bin_name over the command name for the synopsis.
This presents a sample invocation more in line with how the CLI will
be used.
  • Loading branch information
arusahni committed Mar 11, 2023
1 parent c7e929e commit 9b7889a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion clap_mangen/src/render.rs
Expand Up @@ -29,7 +29,10 @@ pub(crate) fn description(roff: &mut Roff, cmd: &clap::Command) {
}

pub(crate) fn synopsis(roff: &mut Roff, cmd: &clap::Command) {
let mut line = vec![bold(cmd.get_name()), roman(" ")];
let mut line = vec![
bold(cmd.get_bin_name().unwrap_or_else(|| cmd.get_name())),
roman(" "),
];

for opt in cmd.get_arguments().filter(|i| !i.is_hide_set()) {
let (lhs, rhs) = option_markers(opt);
Expand Down

0 comments on commit 9b7889a

Please sign in to comment.