From f707299b1ac07935ddb4773f96beac3867f56925 Mon Sep 17 00:00:00 2001 From: Thomas Raimond Date: Fri, 27 Jan 2017 12:15:23 +0100 Subject: [PATCH 1/5] feat(aws-plugin): added aws profile in prompt --- bullet-train.zsh-theme | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/bullet-train.zsh-theme b/bullet-train.zsh-theme index 7378c63..cd17110 100644 --- a/bullet-train.zsh-theme +++ b/bullet-train.zsh-theme @@ -27,6 +27,7 @@ if [ ! -n "${BULLETTRAIN_PROMPT_ORDER+1}" ]; then ruby virtualenv nvm + aws go git hg @@ -103,6 +104,20 @@ if [ ! -n "${BULLETTRAIN_NVM_PREFIX+1}" ]; then BULLETTRAIN_NVM_PREFIX="⬡ " fi +# AWS +if [ ! -n "${BULLETTRAIN_AWS_SHOW+1}" ]; then + BULLETTRAIN_AWS_SHOW=true +fi +if [ ! -n "${BULLETTRAIN_AWS_BG+1}" ]; then + BULLETTRAIN_AWS_BG=red +fi +if [ ! -n "${BULLETTRAIN_AWS_FG+1}" ]; then + BULLETTRAIN_AWS_FG=white +fi +if [ ! -n "${BULLETTRAIN_AWS_PREFIX+1}" ]; then + BULLETTRAIN_AWS_PREFIX="☁️ " +fi + # RUBY if [ ! -n "${BULLETTRAIN_RUBY_BG+1}" ]; then BULLETTRAIN_RUBY_BG=magenta @@ -494,6 +509,19 @@ prompt_nvm() { prompt_segment $BULLETTRAIN_NVM_BG $BULLETTRAIN_NVM_FG $BULLETTRAIN_NVM_PREFIX$nvm_prompt } +# AWS Profile +prompt_aws() { + if [[ $BULLETTRAIN_AWS_SHOW == false ]]; then + return + fi + + local aws_profile="$AWS_DEFAULT_PROFILE" + + if [[ -n "$aws_profile" ]]; then + prompt_segment $BULLETTRAIN_AWS_BG $BULLETTRAIN_AWS_FG $BULLETTRAIN_AWS_PREFIX$aws_profile + fi +} + prompt_time() { if [[ $BULLETTRAIN_TIME_12HR == true ]]; then prompt_segment $BULLETTRAIN_TIME_BG $BULLETTRAIN_TIME_FG %D{%r} From 6ec2a1c61973ea5b73e562f6557d8f2cfcd1f7e7 Mon Sep 17 00:00:00 2001 From: Thomas Raimond Date: Fri, 27 Jan 2017 14:05:29 +0100 Subject: [PATCH 2/5] fix(awsprofile): removing deprecated _SHOW var --- bullet-train.zsh-theme | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/bullet-train.zsh-theme b/bullet-train.zsh-theme index cd17110..e1d8f57 100644 --- a/bullet-train.zsh-theme +++ b/bullet-train.zsh-theme @@ -105,14 +105,11 @@ if [ ! -n "${BULLETTRAIN_NVM_PREFIX+1}" ]; then fi # AWS -if [ ! -n "${BULLETTRAIN_AWS_SHOW+1}" ]; then - BULLETTRAIN_AWS_SHOW=true -fi if [ ! -n "${BULLETTRAIN_AWS_BG+1}" ]; then - BULLETTRAIN_AWS_BG=red + BULLETTRAIN_AWS_BG=yellow fi if [ ! -n "${BULLETTRAIN_AWS_FG+1}" ]; then - BULLETTRAIN_AWS_FG=white + BULLETTRAIN_AWS_FG=black fi if [ ! -n "${BULLETTRAIN_AWS_PREFIX+1}" ]; then BULLETTRAIN_AWS_PREFIX="☁️ " @@ -511,11 +508,7 @@ prompt_nvm() { # AWS Profile prompt_aws() { - if [[ $BULLETTRAIN_AWS_SHOW == false ]]; then - return - fi - - local aws_profile="$AWS_DEFAULT_PROFILE" + local aws_profile="$AWS_PROFILE" if [[ -n "$aws_profile" ]]; then prompt_segment $BULLETTRAIN_AWS_BG $BULLETTRAIN_AWS_FG $BULLETTRAIN_AWS_PREFIX$aws_profile From 1e8be1b5630e00bbf15f6b59bd72923c78aa3b43 Mon Sep 17 00:00:00 2001 From: Thomas Raimond Date: Wed, 19 Apr 2017 15:40:01 +0200 Subject: [PATCH 3/5] doc(awsprofile): added AWS section in README --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 76fdf73..9e98fe5 100644 --- a/README.md +++ b/README.md @@ -178,6 +178,14 @@ NOTE: You do not need to specify *end* segment - it will be added automatically. |`BULLETTRAIN_GO_FG`|`white`|Foreground color |`BULLETTRAIN_GO_PREFIX`|`go`|Prefix of the segment +### AWS Profile + +|Variable|Default|Meaning +|--------|-------|-------| +|`BULLETTRAIN_AWS_BG`|`yellow`|Background color +|`BULLETTRAIN_AWS_FG`|`black`|Foreground color +|`BULLETTRAIN_AWS_PREFIX`|`☁️ `|Prefix of the segment + ### Perl |Variable|Default|Meaning From 761cd01d374412219113ac51418a34f73fe6c9d7 Mon Sep 17 00:00:00 2001 From: Thomas Raimond Date: Wed, 19 Apr 2017 17:19:46 +0200 Subject: [PATCH 4/5] fix(awsprofile): spaces in prefix --- README.md | 2 +- bullet-train.zsh-theme | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9e98fe5..5f97a79 100644 --- a/README.md +++ b/README.md @@ -184,7 +184,7 @@ NOTE: You do not need to specify *end* segment - it will be added automatically. |--------|-------|-------| |`BULLETTRAIN_AWS_BG`|`yellow`|Background color |`BULLETTRAIN_AWS_FG`|`black`|Foreground color -|`BULLETTRAIN_AWS_PREFIX`|`☁️ `|Prefix of the segment +|`BULLETTRAIN_AWS_PREFIX`|`☁️`|Prefix of the segment ### Perl diff --git a/bullet-train.zsh-theme b/bullet-train.zsh-theme index e1d8f57..2ebdf30 100644 --- a/bullet-train.zsh-theme +++ b/bullet-train.zsh-theme @@ -112,7 +112,7 @@ if [ ! -n "${BULLETTRAIN_AWS_FG+1}" ]; then BULLETTRAIN_AWS_FG=black fi if [ ! -n "${BULLETTRAIN_AWS_PREFIX+1}" ]; then - BULLETTRAIN_AWS_PREFIX="☁️ " + BULLETTRAIN_AWS_PREFIX="☁️" fi # RUBY @@ -506,12 +506,12 @@ prompt_nvm() { prompt_segment $BULLETTRAIN_NVM_BG $BULLETTRAIN_NVM_FG $BULLETTRAIN_NVM_PREFIX$nvm_prompt } -# AWS Profile prompt_aws() { local aws_profile="$AWS_PROFILE" + local spaces=" " if [[ -n "$aws_profile" ]]; then - prompt_segment $BULLETTRAIN_AWS_BG $BULLETTRAIN_AWS_FG $BULLETTRAIN_AWS_PREFIX$aws_profile + prompt_segment $BULLETTRAIN_AWS_BG $BULLETTRAIN_AWS_FG $BULLETTRAIN_AWS_PREFIX$spaces$aws_profile fi } From 70aa6f1f7226b4b09095998c12c72a1bb22a6e47 Mon Sep 17 00:00:00 2001 From: Thomas Raimond Date: Wed, 19 Apr 2017 17:22:31 +0200 Subject: [PATCH 5/5] refacto(awsprofile): useless var removed --- README.md | 3 +++ bullet-train.zsh-theme | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5f97a79..0169c8c 100644 --- a/README.md +++ b/README.md @@ -180,6 +180,9 @@ NOTE: You do not need to specify *end* segment - it will be added automatically. ### AWS Profile +Displays which AWS (Amazon Web Services) credentials profile is currently set. +This environment var is used by aws-cli and other tools to use the right access keys and other parameters. + |Variable|Default|Meaning |--------|-------|-------| |`BULLETTRAIN_AWS_BG`|`yellow`|Background color diff --git a/bullet-train.zsh-theme b/bullet-train.zsh-theme index 2ebdf30..33dc424 100644 --- a/bullet-train.zsh-theme +++ b/bullet-train.zsh-theme @@ -506,12 +506,12 @@ prompt_nvm() { prompt_segment $BULLETTRAIN_NVM_BG $BULLETTRAIN_NVM_FG $BULLETTRAIN_NVM_PREFIX$nvm_prompt } +#AWS Profile prompt_aws() { - local aws_profile="$AWS_PROFILE" local spaces=" " - if [[ -n "$aws_profile" ]]; then - prompt_segment $BULLETTRAIN_AWS_BG $BULLETTRAIN_AWS_FG $BULLETTRAIN_AWS_PREFIX$spaces$aws_profile + if [[ -n "$AWS_PROFILE" ]]; then + prompt_segment $BULLETTRAIN_AWS_BG $BULLETTRAIN_AWS_FG $BULLETTRAIN_AWS_PREFIX$spaces$AWS_PROFILE fi }