Skip to content

Commit

Permalink
Merge pull request #5663 from epage/dyn
Browse files Browse the repository at this point in the history
fix(complete)!: Error, rather than default, on unknown shell
  • Loading branch information
epage committed Aug 11, 2024
2 parents 93e050b + 0d7cb9e commit dcdfda7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions clap_complete/src/dynamic/shells/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,12 @@ impl CompleteArgs {
pub fn try_complete(&self, cmd: &mut clap::Command) -> clap::error::Result<()> {
debug!("CompleteCommand::try_complete: {self:?}");

let shell = self
.shell
.or_else(|| Shell::from_env())
.unwrap_or(Shell::Bash);
let shell = self.shell.or_else(|| Shell::from_env()).ok_or_else(|| {
std::io::Error::new(
std::io::ErrorKind::Other,
"unknown shell, please specify the name of your shell",
)
})?;

if let Some(comp_words) = self.comp_words.as_ref() {
let current_dir = std::env::current_dir().ok();
Expand Down

0 comments on commit dcdfda7

Please sign in to comment.