From 532a784b806375370022605d8be17c1116553572 Mon Sep 17 00:00:00 2001 From: David Kane Date: Sun, 24 Mar 2019 18:37:07 +0000 Subject: aws: refactor AWS plugin (#7615) * Update the AWS plugin to support disabling RPROMT display: Use a $SHOW_AWS_PROMPT option. * Refactoring aws plugin: Exposing customizable aws_prompt_info function to be used in themes. * Set aws prompt prefix and suffix to original values and fix README Co-authored-by: "Vassilis S. Moustakas" --- plugins/aws/README.md | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'plugins/aws/README.md') diff --git a/plugins/aws/README.md b/plugins/aws/README.md index 8a45199b8..57ab1e5ac 100644 --- a/plugins/aws/README.md +++ b/plugins/aws/README.md @@ -1,8 +1,7 @@ # 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`. +and a few utilities to manage AWS profiles and display them in the prompt. To use it, add `aws` to the plugins array in your zshrc file. @@ -12,9 +11,23 @@ plugins=(... aws) ## Plugin commands -* `asp `: Sets `AWS_PROFILE` and `AWS_DEFAULT_PROFILE` (legacy) to ``. -It also adds it to your RPROMPT. +* `asp []`: Sets `$AWS_PROFILE` and `$AWS_DEFAULT_PROFILE` (legacy) to ``. + Run `asp` without arguments to clear the profile. -* `agp`: Gets the current value of `AWS_PROFILE`. +* `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. +* `aws_profiles`: Lists the available profiles in the `$AWS_CONFIG_FILE` (default: `~/.aws/config`). + Used to provide completion for the `asp` function. + +## Plugin options + +* Set `SHOW_AWS_PROMPT=false` in your zshrc file if you want to prevent the plugin from modifying your RPROMPT. + +## Theme + +The plugin creates an `aws_prompt_info` function that you can use in your theme, which displays +the current `$AWS_PROFILE`. It uses two variables to control how that is shown: + +- ZSH_THEME_AWS_PREFIX: sets the prefix of the AWS_PROFILE. Defaults to ``. -- cgit v1.2.3-70-g09d2 From 8cbdd79517d710e5bab6ce7aca0754b37462f2ee Mon Sep 17 00:00:00 2001 From: Logan Lindquist Date: Sun, 24 Mar 2019 13:46:27 -0500 Subject: aws: set AWS_EB_PROFILE for the EB CLI (#7388) Added AWS_EB_PROFILE environment variable to the AWS Plugin. The EB CLI uses this variable instead of the primary AWS_PROFILE variable to keep track of what profile it is using. https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-configuration.html --- plugins/aws/README.md | 1 + plugins/aws/aws.plugin.zsh | 1 + 2 files changed, 2 insertions(+) (limited to 'plugins/aws/README.md') diff --git a/plugins/aws/README.md b/plugins/aws/README.md index 57ab1e5ac..45e6de937 100644 --- a/plugins/aws/README.md +++ b/plugins/aws/README.md @@ -12,6 +12,7 @@ plugins=(... aws) ## Plugin commands * `asp []`: Sets `$AWS_PROFILE` and `$AWS_DEFAULT_PROFILE` (legacy) to ``. + It also sets `$AWS_EB_PROFILE` to `` for the Elastic Beanstalk CLI. Run `asp` without arguments to clear the profile. * `agp`: Gets the current value of `$AWS_PROFILE`. diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh index 2fb351812..944557e14 100644 --- a/plugins/aws/aws.plugin.zsh +++ b/plugins/aws/aws.plugin.zsh @@ -7,6 +7,7 @@ function agp { function asp { export AWS_DEFAULT_PROFILE=$1 export AWS_PROFILE=$1 + export AWS_EB_PROFILE=$1 if [[ -z "$1" ]]; then echo AWS profile cleared. -- cgit v1.2.3-70-g09d2 From 6d143d42ea2e16610855e5b1e912b2962d44d9ab Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sun, 24 Mar 2019 19:54:56 +0100 Subject: aws: document aws_change_access_key and fix README --- plugins/aws/README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'plugins/aws/README.md') diff --git a/plugins/aws/README.md b/plugins/aws/README.md index 45e6de937..a52024128 100644 --- a/plugins/aws/README.md +++ b/plugins/aws/README.md @@ -11,13 +11,15 @@ plugins=(... aws) ## Plugin commands -* `asp []`: Sets `$AWS_PROFILE` and `$AWS_DEFAULT_PROFILE` (legacy) to ``. +* `asp []`: sets `$AWS_PROFILE` and `$AWS_DEFAULT_PROFILE` (legacy) to ``. It also sets `$AWS_EB_PROFILE` to `` for the Elastic Beanstalk CLI. Run `asp` without arguments to clear the profile. -* `agp`: Gets the current value of `$AWS_PROFILE`. +* `agp`: gets the current value of `$AWS_PROFILE`. -* `aws_profiles`: Lists the available profiles in the `$AWS_CONFIG_FILE` (default: `~/.aws/config`). +* `aws_change_access_key`: changes the AWS access key of a profile. + +* `aws_profiles`: lists the available profiles in the `$AWS_CONFIG_FILE` (default: `~/.aws/config`). Used to provide completion for the `asp` function. ## Plugin options -- cgit v1.2.3-70-g09d2 From 53d6a692d14a035d03765e72c7c9425bba1b3972 Mon Sep 17 00:00:00 2001 From: programmer04 Date: Mon, 8 Apr 2019 22:08:37 +0200 Subject: Fix showing aws prompt for theme fishy (append RPROMPT instead of overwrite) --- plugins/aws/README.md | 2 +- themes/fishy.zsh-theme | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins/aws/README.md') diff --git a/plugins/aws/README.md b/plugins/aws/README.md index a52024128..d83c3fafe 100644 --- a/plugins/aws/README.md +++ b/plugins/aws/README.md @@ -24,7 +24,7 @@ plugins=(... aws) ## Plugin options -* Set `SHOW_AWS_PROMPT=false` in your zshrc file if you want to prevent the plugin from modifying your RPROMPT. +* Set `SHOW_AWS_PROMPT=false` in your zshrc file if you want to prevent the plugin from modifying your RPROMPT. Some plugins overwrite the value of RPROMPT instead of appending to it, so they need to be fixed to see a default aws plugin RPROMPT message (for example theme fishy is fixed). ## Theme diff --git a/themes/fishy.zsh-theme b/themes/fishy.zsh-theme index 83bd455b5..00a60f45b 100644 --- a/themes/fishy.zsh-theme +++ b/themes/fishy.zsh-theme @@ -14,7 +14,7 @@ PROMPT='%n@%m %{$fg[$user_color]%}$(_fishy_collapsed_wd)%{$reset_color%}%(!.#.>) PROMPT2='%{$fg[red]%}\ %{$reset_color%}' local return_status="%{$fg_bold[red]%}%(?..%?)%{$reset_color%}" -RPROMPT='${return_status}$(git_prompt_info)$(git_prompt_status)%{$reset_color%}' +RPROMPT="${RPROMPT}"'${return_status}$(git_prompt_info)$(git_prompt_status)%{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX=" " ZSH_THEME_GIT_PROMPT_SUFFIX="" -- cgit v1.2.3-70-g09d2 From 63291f4fcc07de3014362ef5101132d91ad3d497 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 9 Apr 2019 18:24:04 +0200 Subject: Reword and fix formatting --- plugins/aws/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'plugins/aws/README.md') diff --git a/plugins/aws/README.md b/plugins/aws/README.md index d83c3fafe..57c3b54ac 100644 --- a/plugins/aws/README.md +++ b/plugins/aws/README.md @@ -24,7 +24,9 @@ plugins=(... aws) ## Plugin options -* Set `SHOW_AWS_PROMPT=false` in your zshrc file if you want to prevent the plugin from modifying your RPROMPT. Some plugins overwrite the value of RPROMPT instead of appending to it, so they need to be fixed to see a default aws plugin RPROMPT message (for example theme fishy is fixed). +* Set `SHOW_AWS_PROMPT=false` in your zshrc file if you want to prevent the plugin from modifying your RPROMPT. + Some themes might overwrite the value of RPROMPT instead of appending to it, so they'll need to be fixed to + see the AWS profile prompt. ## Theme -- cgit v1.2.3-70-g09d2