Skip to content

Commit

Permalink
fix: set binary name for completions
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaunSHamilton committed Oct 13, 2023
1 parent 1955a57 commit eab22bd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/plumbing/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1221,13 +1221,17 @@ pub fn main() -> Result<()> {
},
Subcommands::Completions { shell, out_dir } => {
let mut app = Args::command();

let bin_name = "gix";
app.set_bin_name(bin_name);

let shell = shell
.or_else(clap_complete::Shell::from_env)
.ok_or_else(|| anyhow!("The shell could not be derived from the environment"))?;
if let Some(out_dir) = out_dir {
clap_complete::generate_to(shell, &mut app, env!("CARGO_PKG_NAME"), &out_dir)?;
clap_complete::generate_to(shell, &mut app, bin_name, &out_dir)?;
} else {
clap_complete::generate(shell, &mut app, env!("CARGO_PKG_NAME"), &mut std::io::stdout());
clap_complete::generate(shell, &mut app, bin_name, &mut std::io::stdout());
}
Ok(())
}
Expand Down

0 comments on commit eab22bd

Please sign in to comment.