Skip to content

Commit 3b99593

Browse files
authored
Merge pull request #5896 from epage/env
feat(complete): Provide a way to disable env completions
2 parents c4105bd + f5fc765 commit 3b99593

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

clap_complete/src/env/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@
6161
//! ```zsh
6262
//! echo "source <(COMPLETE=zsh your_program)" >> ~/.zshrc
6363
//! ```
64+
//!
65+
//! To disable completions, you can set `COMPLETE=` or `COMPLETE=0`
6466
6567
mod shells;
6668

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

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

0 commit comments

Comments
 (0)