From 08e77c53ea98ec476c12e1417b2330176b06fe5c Mon Sep 17 00:00:00 2001 From: Manuel Date: Fri, 21 Feb 2025 16:33:25 +0100 Subject: [PATCH 1/3] feat: Generate completions globally --- src/uv/NOTES.md | 20 -------------------- src/uv/install.sh | 13 +++---------- 2 files changed, 3 insertions(+), 30 deletions(-) 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..3fde468 100644 --- a/src/uv/install.sh +++ b/src/uv/install.sh @@ -156,16 +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 + ${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 [ -f "$_REMOTE_USER_HOME/.elvish/rc.elv" ]; then echo "eval (${command} elvish | slurp)" >> $_REMOTE_USER_HOME/.elvish/rc.elv fi From 71c6b796c22e86a5112d7868e95a3c95900a0638 Mon Sep 17 00:00:00 2001 From: Valentin Date: Mon, 24 Feb 2025 16:22:12 +0000 Subject: [PATCH 2/3] fix: removed elvish completion since it's non working --- src/uv/install.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/uv/install.sh b/src/uv/install.sh index 3fde468..c16319c 100644 --- a/src/uv/install.sh +++ b/src/uv/install.sh @@ -159,9 +159,6 @@ enable_autocompletion() { ${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 [ -f "$_REMOTE_USER_HOME/.elvish/rc.elv" ]; then - echo "eval (${command} elvish | slurp)" >> $_REMOTE_USER_HOME/.elvish/rc.elv - fi } if [ "$AUTOCOMPLETION" = "true" ]; then From 22bda1ab6a974d18dee57152e19211853fab3552 Mon Sep 17 00:00:00 2001 From: Valentin Date: Mon, 24 Feb 2025 16:23:09 +0000 Subject: [PATCH 3/3] feat: added fish to tests --- test/uv/scenarios.json | 2 +- test/uv/uv-autocomplete.sh | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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.