Skip to content

Shell integration templates should understand the global -C flag #2056

Description

@fengmk2

Follow-up to #2031 (global -C <dir> flag), from Codex review round 4. Two gaps in the generated shell integration under crates/vite_global_cli/src/commands/env/setup.rs:

  1. The vp wrapper functions (sh, fish, nu, PowerShell) intercept env use by checking the first two arguments literally, so vp -C <dir> env use bypasses the eval path: the binary prints exports instead of applying them to the current shell session. The wrappers should skip a leading -C <dir> / -C<dir> / -C=<dir> before matching env use.

  2. The generated vpr completers (zsh, fish, nu, PowerShell) translate the command line by inserting run immediately after vpr, producing vp run -C <dir> ... instead of vp -C <dir> run ..., so vpr -C <dir> <TAB> completes tasks from the wrong directory (runtime vpr -C itself works; this is completion only).

Both need template changes across four shell dialects plus snapshot coverage for the generated scripts, which is why this is split out of #2031 rather than patched inline there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions