Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 539696c

Browse files
committed
Remove shell detection message
1 parent d7bc441 commit 539696c

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/cmds/completions.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,11 @@ fn get_completions_string<G: Generator>(gen: G, cmd: &mut ClapCommand) -> Result
4949
}
5050

5151
pub fn completion_handler(m: &ArgMatches, cmd: &mut ClapCommand) -> Result<(), Error> {
52-
let shell_result = m.get_one::<Shell>("shell");
53-
if let Some(shell) = shell_result {
54-
// Shell argument is provided, use it directly
55-
let completions = get_completions_string(*shell, cmd)?;
56-
println!("{}", completions);
57-
} else {
58-
// Shell argument is not provided, fall back to the default shell from the environment
59-
let shell = Shell::from_env().ok_or(Error::MatchError)?;
60-
let completions = get_completions_string(shell, cmd)?;
61-
println!("{}", completions);
62-
println!("# Since shell arg value is not provided trying to get the default shell from the environment.");
63-
}
52+
let shell = *m.get_one::<Shell>("shell").unwrap_or(
53+
// if shell value is not provided try to get from the environment
54+
&Shell::from_env().ok_or(Error::MatchError)?,
55+
);
56+
let completions = get_completions_string(shell, cmd)?;
57+
println!("{}", completions);
6458
Ok(())
6559
}

0 commit comments

Comments
 (0)