From e8c328cb394e39f8d1c7d18b85b0be12bd71c556 Mon Sep 17 00:00:00 2001 From: Hosh Date: Thu, 10 May 2018 19:53:16 +0100 Subject: Update AWS completion (#6745) --- plugins/aws/aws.plugin.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'plugins/aws') diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh index 6a0e04add..a326e2e01 100644 --- a/plugins/aws/aws.plugin.zsh +++ b/plugins/aws/aws.plugin.zsh @@ -42,11 +42,11 @@ function aws_profiles { compctl -K aws_profiles asp -if _homebrew-installed && _awscli-homebrew-installed ; then +if which aws_zsh_completer.sh &>/dev/null; then + _aws_zsh_completer_path=$(which aws_zsh_completer.sh 2>/dev/null) +elif _homebrew-installed && _awscli-homebrew-installed; then _aws_zsh_completer_path=$_brew_prefix/libexec/bin/aws_zsh_completer.sh -else - _aws_zsh_completer_path=$(which aws_zsh_completer.sh) fi -[ -x $_aws_zsh_completer_path ] && source $_aws_zsh_completer_path +[ -n "$_aws_zsh_completer_path" ] && [ -x $_aws_zsh_completer_path ] && source $_aws_zsh_completer_path unset _aws_zsh_completer_path -- cgit v1.2.3-70-g09d2 From e8aaab56b9f007cd5a285099fa101a63214622ee Mon Sep 17 00:00:00 2001 From: Frank Wittig Date: Wed, 9 Apr 2014 18:11:06 +0200 Subject: allow . in profile names --- plugins/aws/aws.plugin.zsh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'plugins/aws') diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh index a326e2e01..183b0f226 100644 --- a/plugins/aws/aws.plugin.zsh +++ b/plugins/aws/aws.plugin.zsh @@ -37,9 +37,8 @@ function asp { } function aws_profiles { - reply=($(grep profile $AWS_HOME/config|sed -e 's/.*profile \([a-zA-Z0-9_-]*\).*/\1/')) + reply=($(grep profile $AWS_HOME/config|sed -e 's/.*profile \([a-zA-Z0-9_\.-]*\).*/\1/')) } - compctl -K aws_profiles asp if which aws_zsh_completer.sh &>/dev/null; then -- cgit v1.2.3-70-g09d2 From 684feffc355df95c804a6a32196248bacfefebe7 Mon Sep 17 00:00:00 2001 From: Jorge Luis Vargas Aguilar Date: Sun, 28 Oct 2018 05:17:41 -0700 Subject: aws: add README (#7357) --- plugins/aws/README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 plugins/aws/README.md (limited to 'plugins/aws') diff --git a/plugins/aws/README.md b/plugins/aws/README.md new file mode 100644 index 000000000..8a45199b8 --- /dev/null +++ b/plugins/aws/README.md @@ -0,0 +1,20 @@ +# aws + +This plugin provides completion support for [awscli](https://docs.aws.amazon.com/cli/latest/reference/index.html) +and a few utilities to manage AWS profiles: a function to change profiles with autocompletion support +and a function to get the current AWS profile. The current AWS profile is also displayed in `RPROMPT`. + +To use it, add `aws` to the plugins array in your zshrc file. + +```zsh +plugins=(... aws) +``` + +## Plugin commands + +* `asp `: Sets `AWS_PROFILE` and `AWS_DEFAULT_PROFILE` (legacy) to ``. +It also adds it to your RPROMPT. + +* `agp`: Gets the current value of `AWS_PROFILE`. + +* `aws_profiles`: Lists the available profiles in the file referenced in `AWS_CONFIG_FILE` (default: ~/.aws/config). Used to provide completion for the `asp` function. -- cgit v1.2.3-70-g09d2 From e4946ef9f94360dd4767c2e58274cd62057822a5 Mon Sep 17 00:00:00 2001 From: "Vargas, Jorge L" Date: Sat, 27 Oct 2018 15:21:18 -0700 Subject: aws: change AWS_DEFAULT_PROFILE to AWS_PROFILE The environment variable name used to be AWS_DEFAULT_PROFILE but the CLI documentation now only mentions AWS_PROFILE. https://docs.aws.amazon.com/cli/latest/userguide/cli-environment.html It seems like the CLI was the only tool using AWS_DEFAULT_PROFILE, and all the AWS SDKs used AWS_PROFILE, so they standardized on it. https://onetechnical.wordpress.com/2016/10/07/the-curious-case-of-aws_default_profile/ Note: still left AWS_DEFAULT_PROFILE on the method to set the profile to maintain backwards compatibility. Close #7354 --- plugins/aws/aws.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins/aws') diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh index 183b0f226..252c0d9c1 100644 --- a/plugins/aws/aws.plugin.zsh +++ b/plugins/aws/aws.plugin.zsh @@ -24,7 +24,7 @@ _awscli-homebrew-installed() { export AWS_HOME=~/.aws function agp { - echo $AWS_DEFAULT_PROFILE + echo $AWS_PROFILE } function asp { @@ -33,7 +33,7 @@ function asp { export AWS_DEFAULT_PROFILE=$1 export AWS_PROFILE=$1 - export RPROMPT="$rprompt" + export RPROMPT="$rprompt" } function aws_profiles { -- cgit v1.2.3-70-g09d2 From 543044efe3940b623069996cf6b2f5127635815f Mon Sep 17 00:00:00 2001 From: Jorge Vargas Date: Sat, 27 Oct 2018 15:59:03 -0700 Subject: aws: use AWS_CONFIG_FILE to complete profiles Stop exporting AWS_HOME and use the standard AWS_CONFIG_FILE environment variable, with a fallback to ~/.aws/config (default location) if not defined. Close #7356 --- plugins/aws/aws.plugin.zsh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'plugins/aws') diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh index 252c0d9c1..f78e96ce3 100644 --- a/plugins/aws/aws.plugin.zsh +++ b/plugins/aws/aws.plugin.zsh @@ -21,8 +21,6 @@ _awscli-homebrew-installed() { [ -r $_brew_prefix/libexec/bin/aws_zsh_completer.sh ] &> /dev/null } -export AWS_HOME=~/.aws - function agp { echo $AWS_PROFILE } @@ -37,7 +35,7 @@ function asp { } function aws_profiles { - reply=($(grep profile $AWS_HOME/config|sed -e 's/.*profile \([a-zA-Z0-9_\.-]*\).*/\1/')) + reply=($(grep profile "${AWS_CONFIG_FILE:-$HOME/.aws/config}"|sed -e 's/.*profile \([a-zA-Z0-9_\.-]*\).*/\1/')) } compctl -K aws_profiles asp -- cgit v1.2.3-70-g09d2