Skip to content

Commit

Permalink
Merge pull request #5896 from epage/env
Browse files Browse the repository at this point in the history
feat(complete): Provide a way to disable env completions
  • Loading branch information
epage authored Jan 29, 2025
2 parents c4105bd + f5fc765 commit 3b99593
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions clap_complete/src/env/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
//! ```zsh
//! echo "source <(COMPLETE=zsh your_program)" >> ~/.zshrc
//! ```
//!
//! To disable completions, you can set `COMPLETE=` or `COMPLETE=0`
mod shells;

Expand Down Expand Up @@ -218,6 +220,9 @@ impl<'s, F: Fn() -> clap::Command> CompleteEnv<'s, F> {
let Some(name) = std::env::var_os(self.var) else {
return Ok(false);
};
if name.is_empty() || name == "0" {
return Ok(false);
}

// Ensure any child processes called for custom completers don't activate their own
// completion logic.
Expand Down

0 comments on commit 3b99593

Please sign in to comment.