Skip to content

Commit

Permalink
fix(complete): Fix env leakage in elvish dynamic completion
Browse files Browse the repository at this point in the history
  • Loading branch information
tw4452852 committed Jan 6, 2025
1 parent 6df1e36 commit fa71ba5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions clap_complete/src/env/shells.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,12 @@ impl EnvCompleter for Elvish {

let script = r#"
set edit:completion:arg-completer[BIN] = { |@words|
set E:_CLAP_IFS = "\n"
tmp E:_CLAP_IFS = "\n"
var index = (count $words)
set index = (- $index 1)
set E:_CLAP_COMPLETE_INDEX = (to-string $index)
set E:VAR = "elvish"
tmp E:_CLAP_COMPLETE_INDEX = (to-string $index)
tmp E:VAR = "elvish"
put (COMPLETER -- $@words) | to-lines
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ set edit:rprompt = (constantly "")
set edit:prompt = (constantly "% ")

set edit:completion:arg-completer[exhaustive] = { |@words|
set E:_CLAP_IFS = "\n"
tmp E:_CLAP_IFS = "\n"

var index = (count $words)
set index = (- $index 1)
set E:_CLAP_COMPLETE_INDEX = (to-string $index)
set E:COMPLETE = "elvish"
tmp E:_CLAP_COMPLETE_INDEX = (to-string $index)
tmp E:COMPLETE = "elvish"

put (exhaustive -- $@words) | to-lines
}
Expand Down

0 comments on commit fa71ba5

Please sign in to comment.