Skip to content
Myr

Merge pull request #1173 from zappolowski/fix-completion-program-name

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Use just the file name of the program name for generating completions

authored by Thayne McCombs · committed by GitHub · parents 85e3ada, 2fcfe7a · Browse files · 1 file+8 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−2 removed

  • other:+8 added−2 removed

1 file+8 added−2 removed

modified:src/main.rs+8 added-2 removed
91 unmodified lines
92#[cfg(feature = "completions")]93#[cold]94fn print_completions(shell: clap_complete::Shell) -> Result<ExitCode> {95 // The program name is the first argument.96 let program_name = env::args().next().unwrap_or_else(|| "fd".to_string());96 let first_arg = env::args().next();97 let program_name = first_arg98 .as_ref()99 .map(Path::new)100 .and_then(|path| path.file_name())101 .and_then(|file| file.to_str())102 .unwrap_or("fd");103 let mut cmd = Opts::command();104 cmd.build();99 clap_complete::generate(shell, &mut cmd, &program_name, &mut std::io::stdout());105 clap_complete::generate(shell, &mut cmd, program_name, &mut std::io::stdout());106 Ok(ExitCode::Success)107}108109fn set_working_dir(opts: &Opts) -> Result<()> {
336 unmodified lines