diff --git a/src/uv/NOTES.md b/src/uv/NOTES.md index 315baed..ac8d12f 100644 --- a/src/uv/NOTES.md +++ b/src/uv/NOTES.md @@ -1,23 +1,3 @@ ## uv Repository * [astral-sh/uv](https://github.com/astral-sh/uv) - -## Fix Autocompletion with feature Shells - -> [!IMPORTANT] -> When installing a shell via another feature, make sure to override the installation order to ensure the generated autocompletion writes to existing files. - -### Autocompletion for Fish Shell - -```json -"features": { - "ghcr.io/meaningful-ooo/devcontainer-features/fish:latest": {}, - "ghcr.io/va-h/devcontainers-features/uv:latest": { - "shellautocompletion": true - } -}, -"overrideFeatureInstallOrder": [ - "ghcr.io/meaningful-ooo/devcontainer-features/fish", - "ghcr.io/va-h/devcontainers-features/uv:latest" -] -``` diff --git a/src/uv/install.sh b/src/uv/install.sh index 5980567..c16319c 100644 --- a/src/uv/install.sh +++ b/src/uv/install.sh @@ -156,19 +156,9 @@ uv --version enable_autocompletion() { command=$1 - if [ -f "$_REMOTE_USER_HOME/.bashrc" ]; then - echo "eval \"\$(${command} bash)\"" >> $_REMOTE_USER_HOME/.bashrc - fi - if [ -f "$_REMOTE_USER_HOME/.zshrc" ]; then - echo "eval \"\$(${command} zsh)\"" >> $_REMOTE_USER_HOME/.zshrc - fi - if [ -d "$_REMOTE_USER_HOME/.config/fish" ]; then - mkdir -p $_REMOTE_USER_HOME/.config/fish/completions - ${command} fish >> $_REMOTE_USER_HOME/.config/fish/completions/uv.fish - fi - if [ -f "$_REMOTE_USER_HOME/.elvish/rc.elv" ]; then - echo "eval (${command} elvish | slurp)" >> $_REMOTE_USER_HOME/.elvish/rc.elv - fi + ${command} bash >> /usr/share/bash-completion/completions/uv + ${command} zsh >> /usr/share/zsh/vendor-completions/_uv + ${command} fish >> /usr/share/fish/completions/uv.fish } if [ "$AUTOCOMPLETION" = "true" ]; then diff --git a/test/uv/scenarios.json b/test/uv/scenarios.json index a1bc199..41bcd91 100644 --- a/test/uv/scenarios.json +++ b/test/uv/scenarios.json @@ -8,7 +8,7 @@ } }, "uv-autocomplete": { - "image": "mcr.microsoft.com/devcontainers/base:ubuntu", + "image": "mcr.microsoft.com/devcontainers/base:debian", "features": { "ghcr.io/devcontainers/features/common-utils:2.5.2": { "installZsh": true, diff --git a/test/uv/uv-autocomplete.sh b/test/uv/uv-autocomplete.sh index 317a394..a118dac 100644 --- a/test/uv/uv-autocomplete.sh +++ b/test/uv/uv-autocomplete.sh @@ -9,8 +9,9 @@ source dev-container-features-test-lib # Feature-specific tests # The 'check' command comes from the dev-container-features-test-lib. -check "uv autocomplete bash" cat ~/.bashrc | grep "eval \"\$(uv" | grep bash -check "uv autocomplete zsh" cat ~/.zshrc | grep "eval \"\$(uv" | grep zsh +check "uv autocomplete bash" [ -e /usr/share/bash-completion/completions/uv ] +check "uv autocomplete zsh" [ -e /usr/share/zsh/vendor-completions/_uv ] +check "uv autocomplete fish" [ -e /usr/share/fish/completions/uv.fish ] # Report results # If any of the checks above exited with a non-zero exit code, the test will fail.