diff --git a/src/aws-cli/devcontainer-feature.json b/src/aws-cli/devcontainer-feature.json index ed2e20284..75d24ca88 100644 --- a/src/aws-cli/devcontainer-feature.json +++ b/src/aws-cli/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "aws-cli", - "version": "1.1.3", + "version": "1.1.4", "name": "AWS CLI", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/aws-cli", "description": "Installs the AWS CLI along with needed dependencies. Useful for base Dockerfiles that often are missing required install dependencies like gpg.", diff --git a/src/aws-cli/install.sh b/src/aws-cli/install.sh index ba6861074..1f6af54bd 100755 --- a/src/aws-cli/install.sh +++ b/src/aws-cli/install.sh @@ -119,16 +119,14 @@ install() { ./aws/install - # kubectl bash completion + # AWS bash completion mkdir -p /etc/bash_completion.d cp ./scripts/vendor/aws_bash_completer /etc/bash_completion.d/aws - # kubectl zsh completion - if [ -e "${USERHOME}/.oh-my-zsh" ]; then - mkdir -p "${USERHOME}/.oh-my-zsh/completions" - cp ./scripts/vendor/aws_zsh_completer.sh "${USERHOME}/.oh-my-zsh/completions/_aws" - chown -R "${USERNAME}" "${USERHOME}/.oh-my-zsh" - fi + # AWS zsh completion + mkdir -p /usr/local/share/zsh/site-functions/ + cp ./scripts/vendor/aws_zsh_completer.sh /usr/local/share/zsh/site-functions/_aws + sed -i '1s/^/#compdef aws\n/' /usr/local/share/zsh/site-functions/_aws rm -rf ./aws } diff --git a/test/aws-cli/scenarios.json b/test/aws-cli/scenarios.json index 9dd703c27..f2577c0ff 100644 --- a/test/aws-cli/scenarios.json +++ b/test/aws-cli/scenarios.json @@ -4,5 +4,14 @@ "features": { "aws-cli": {} } + }, + "zsh_completion": { + "image": "mcr.microsoft.com/devcontainers/base:ubuntu", + "features": { + "common-utils": { + "installZsh": true + }, + "aws-cli": {} + } } } \ No newline at end of file diff --git a/test/aws-cli/zsh_completion.sh b/test/aws-cli/zsh_completion.sh new file mode 100644 index 000000000..ca08e077d --- /dev/null +++ b/test/aws-cli/zsh_completion.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +set -e + +# Import test library for `check` command +source dev-container-features-test-lib + +# Check that the zsh completion file exists in the correct location +check "zsh completion file installed" test -f /usr/local/share/zsh/site-functions/_aws + +# Check that the completion file has the proper zsh completion header +check "zsh completion file has compdef header" grep -q "^#compdef aws" /usr/local/share/zsh/site-functions/_aws + +# Actual ZSH completion testing is a pain, so just ignoring it for now. + +# Report result +reportResults