Move uvx shell completion to uvx --generate-shell-completion (#7511)

## Summary

Because a problem was found with Powershell and combining the generated
completion scripts for uv and uvx, let's try separating uv and uvx
command completion scripts.

The generated powershell script template can be seen in clap_complete
source, and it starts with `using` directives, which makes it impossible
(apparently) to concatenate two of those script outputs.

As a side effect, this is available under `uv tool run
--generate-shell-completion` too.

Fixes #7482

## Test Plan

- `eval "$(cargo run --bin uvx -- --generate-shell-completion bash)"`
- Test Powershell
This commit is contained in:
bluss
2024-09-20 03:27:25 +02:00
committed by GitHub
parent 99d354b893
commit 7a25a82fc9
5 changed files with 65 additions and 23 deletions
+19
View File
@@ -197,6 +197,13 @@ jobs:
$uv venv
$uv pip install ruff
- name: "Smoke test completion"
run: |
uv="./target/debug/uv"
uvx="./target/debug/uvx"
eval "$($uv generate-shell-completion bash)"
eval "$($uvx --generate-shell-completion bash)"
cargo-test-macos:
timeout-minutes: 10
needs: determine_changes
@@ -296,6 +303,18 @@ jobs:
uv venv
uv pip install ruff
- name: "Smoke test completion"
working-directory: ${{ env.UV_WORKSPACE }}
shell: powershell
env:
# Avoid debug build stack overflows.
UV_STACK_SIZE: 2000000
run: |
Set-Alias -Name uv -Value ./target/debug/uv
Set-Alias -Name uvx -Value ./target/debug/uvx
(& uv generate-shell-completion powershell) | Out-String | Invoke-Expression
(& uvx --generate-shell-completion powershell) | Out-String | Invoke-Expression
# Separate jobs for the nightly crate
windows-trampoline-check:
timeout-minutes: 10