Skip to content

Commit b64280f

Browse files
committed
chore(completion): update shell completion variable to VP_COMPLETE
1 parent 80a707e commit b64280f

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

crates/vite_global_cli/src/commands/env/setup.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,9 @@ vp() {
432432
433433
# Dynamic shell completion for bash/zsh
434434
if [ -n "$BASH_VERSION" ] && type complete >/dev/null 2>&1; then
435-
eval "$(COMPLETE=bash command vp)"
435+
eval "$(VP_COMPLETE=bash command vp)"
436436
elif [ -n "$ZSH_VERSION" ] && type compdef >/dev/null 2>&1; then
437-
eval "$(COMPLETE=zsh command vp)"
437+
eval "$(VP_COMPLETE=zsh command vp)"
438438
fi
439439
"#
440440
.replace("__VP_BIN__", &bin_path_ref);
@@ -463,7 +463,7 @@ function vp
463463
end
464464
465465
# Dynamic shell completion for fish
466-
COMPLETE=fish command vp | source
466+
VP_COMPLETE=fish command vp | source
467467
"#
468468
.replace("__VP_BIN__", &bin_path_ref);
469469
let env_fish_file = vite_plus_home.join("env.fish");
@@ -854,11 +854,11 @@ mod tests {
854854

855855
// Verify completion env is set
856856
assert!(
857-
env_content.contains("COMPLETE=bash") && env_content.contains("COMPLETE=zsh"),
857+
env_content.contains("VP_COMPLETE=bash") && env_content.contains("VP_COMPLETE=zsh"),
858858
"env file should contain completion for bash and zsh"
859859
);
860860
assert!(
861-
fish_content.contains("COMPLETE=fish"),
861+
fish_content.contains("VP_COMPLETE=fish"),
862862
"env.fish file should contain completion for fish"
863863
);
864864
assert!(

crates/vite_global_cli/src/main.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,9 @@ async fn main() -> ExitCode {
230230
vite_shared::init_tracing();
231231

232232
// Handle shell completion
233-
CompleteEnv::with_factory(command_with_help).complete();
233+
CompleteEnv::with_factory(command_with_help)
234+
.var("VP_COMPLETE")
235+
.complete();
234236

235237
// Check for shim mode (invoked as node, npm, or npx)
236238
let mut args: Vec<String> = std::env::args().collect();

0 commit comments

Comments
 (0)