Skip to content

Commit

Permalink
elvish completer: prevent env variable leakage
Browse files Browse the repository at this point in the history
  • Loading branch information
tw4452852 authored Jan 6, 2025
1 parent e5f1f48 commit 82d4dfe
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions clap_complete/src/env/shells.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,10 @@ impl EnvCompleter for Elvish {

let script = r#"
set edit:completion:arg-completer[BIN] = { |@words|
set E:_CLAP_IFS = "\n"
var index = (count $words)
set index = (- $index 1)
set E:_CLAP_COMPLETE_INDEX = (to-string $index)
set E:VAR = "elvish"
put (COMPLETER -- $@words) | to-lines
put (env _CLAP_IFS="\n" _CLAP_COMPLETE_INDEX=(to-string $index) VAR="elvish" COMPLETER -- $@words) | to-lines
}
"#
.replace("COMPLETER", &completer)
Expand Down

0 comments on commit 82d4dfe

Please sign in to comment.