Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
Don't hard-code a name that is already set elesewhere.
Reuse it instead.
  • Loading branch information
Byron committed Oct 13, 2023
1 parent eab22bd commit 7f2bc08
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/plumbing/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1222,12 +1222,11 @@ 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"))?;

let bin_name = app.get_name().to_owned();
if let Some(out_dir) = out_dir {
clap_complete::generate_to(shell, &mut app, bin_name, &out_dir)?;
} else {
Expand Down

0 comments on commit 7f2bc08

Please sign in to comment.