Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions crates/vite_global_cli/src/commands/env/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,13 +449,15 @@ if [ -n "$BASH_VERSION" ] && type complete >/dev/null 2>&1; then
eval "$(VP_COMPLETE=bash command vp)"
elif [ -n "$ZSH_VERSION" ] && type compdef >/dev/null 2>&1; then
eval "$(VP_COMPLETE=zsh command vp)"
eval '
_vpr_complete() {
local -a orig=("${words[@]}")
words=("vp" "run" "${orig[@]:1}")
CURRENT=$((CURRENT + 1))
${=_comps[vp]}
}
compdef _vpr_complete vpr
'
fi
"#
.replace("__VP_BIN__", &bin_path_ref);
Expand Down Expand Up @@ -918,6 +920,10 @@ mod tests {
env_content.contains("compdef _vpr_complete vpr"),
"env should have vpr completion for zsh"
);
assert!(
env_content.contains("eval '") && env_content.contains("_vpr_complete() {"),
"env should wrap zsh-specific code in eval"
);
assert!(fish_content.contains("complete -c vpr"), "env.fish should have vpr completion");
assert!(
ps1_content.contains("Register-ArgumentCompleter -Native -CommandName vpr"),
Expand Down
Loading