mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Generate shell completion for uvx
(#7388)
## Summary Generate shell completion for uvx. Create a `uvx` toplevel command just for completion by combining `uv tool uvx` (hidden alias for `uv tool run`) with global arguments. This explicit combination is needed otherwise global arguments are missing (if they are missing, clap debug assertions fail when `uv tool run` arguments refer to global arguments in directives like conflicts with). Fixes #7258 ## Test Plan - Tested using bash using `eval "$(cargo run --bin uv generate-shell-completion bash)"`
This commit is contained in:
parent
d1c7cb8bc2
commit
e9378be919
3 changed files with 62 additions and 13 deletions
|
@ -181,6 +181,25 @@ To enable shell autocompletion for uv commands, run one of the following:
|
|||
|
||||
Then restart the shell or source the shell config file.
|
||||
|
||||
You can also enable shell autocompletion for uvx by running the same commands, replacing `uv` with
|
||||
`uvx`:
|
||||
|
||||
=== "Linux and macOS"
|
||||
|
||||
```bash
|
||||
# Determine your shell (e.g., with `echo $SHELL`), then run one of:
|
||||
echo 'eval "$(uvx generate-shell-completion bash)"' >> ~/.bashrc
|
||||
echo 'eval "$(uvx generate-shell-completion zsh)"' >> ~/.zshrc
|
||||
echo 'uvx generate-shell-completion fish | source' >> ~/.config/fish/config.fish
|
||||
echo 'eval (uvx generate-shell-completion elvish | slurp)' >> ~/.elvish/rc.elv
|
||||
```
|
||||
|
||||
=== "Windows"
|
||||
|
||||
```powershell
|
||||
Add-Content -Path $PROFILE -Value '(& uvx generate-shell-completion powershell) | Out-String | Invoke-Expression'
|
||||
```
|
||||
|
||||
## Uninstallation
|
||||
|
||||
If you need to remove uv from your system, just remove the `uv` and `uvx` binaries:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue