Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions src/uv/NOTES.md
Original file line number Diff line number Diff line change
@@ -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"
]
```
16 changes: 3 additions & 13 deletions src/uv/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/uv/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions test/uv/uv-autocomplete.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down