From af119c9406de68b91a6231114caa8b23bcfa8243 Mon Sep 17 00:00:00 2001 From: James Bowman Date: Tue, 8 Dec 2015 22:33:01 -0800 Subject: [PATCH 1/5] Adding command prompt for AWS Elastic Beanstalk environment name. --- functions/icons.zsh | 3 +++ powerlevel9k.zsh-theme | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/functions/icons.zsh b/functions/icons.zsh index aad62dc1..403802aa 100644 --- a/functions/icons.zsh +++ b/functions/icons.zsh @@ -29,6 +29,7 @@ case $POWERLEVEL9K_MODE in ROOT_ICON $'\UE801' #  RUBY_ICON $'\UE847 ' #  AWS_ICON $'\UE895' #  + AWS_EB_ICON $'\U1F331' # 🌱 BACKGROUND_JOBS_ICON $'\UE82F ' #  TEST_ICON $'\UE891' #  TODO_ICON $'\U2611' # ☑ @@ -82,6 +83,7 @@ case $POWERLEVEL9K_MODE in ROOT_ICON $'\uF201' #  RUBY_ICON $'\UF219 ' #  AWS_ICON $'\UF296' #  + AWS_EB_ICON $'\U1F331' # 🌱 BACKGROUND_JOBS_ICON $'\UF013 ' #  TEST_ICON $'\UF291' #  TODO_ICON $'\U2611' # ☑ @@ -130,6 +132,7 @@ case $POWERLEVEL9K_MODE in ROOT_ICON $'\u26A1' # ⚡ RUBY_ICON '' AWS_ICON 'AWS:' + AWS_EB_ICON $'\U1F331' # 🌱 BACKGROUND_JOBS_ICON $'\u2699' # ⚙ TEST_ICON '' TODO_ICON $'\U2611' # ☑ diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 6f34b94c..6ac25d77 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -289,6 +289,14 @@ prompt_aws() { fi } +# Current Elastic Beanstalk environment +prompt_aws_eb_env() { + if [ -e .elasticbeanstalk/config.yml ]; then + local eb_env=$(cat .elasticbeanstalk/config.yml | grep environment 2> /dev/null | awk '{print $2}') + "$1_prompt_segment" "$0" black green "$(print_icon 'AWS_EB_ICON') $eb_env" + fi +} + # Segment to indicate background jobs with an icon. set_default POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE true prompt_background_jobs() { From a6174e31ea24a9cba6163780058e20b653afe1a4 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sun, 17 Jan 2016 12:28:42 +0100 Subject: [PATCH 2/5] Added documentation for the AWS Beanstalk segment. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 800711de..567db77f 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ your `~/.zshrc`: The segments that are currently available are: * [aws](#aws) - The current AWS profile, if active. +* **aws_eb_env** - The current Elastic Beanstalk Environment. * [background_jobs](#background_jobs) - Indicator for background jobs. * [battery](#battery) - Current battery status. * [context](#context) - Your username and host. From 6763826c4e131797b2c86c3e14cab0eb954e6e82 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sun, 17 Jan 2016 12:31:36 +0100 Subject: [PATCH 3/5] More space for the Beanstalk-Icon. --- functions/icons.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/functions/icons.zsh b/functions/icons.zsh index 403802aa..1eaef3d6 100644 --- a/functions/icons.zsh +++ b/functions/icons.zsh @@ -29,7 +29,7 @@ case $POWERLEVEL9K_MODE in ROOT_ICON $'\UE801' #  RUBY_ICON $'\UE847 ' #  AWS_ICON $'\UE895' #  - AWS_EB_ICON $'\U1F331' # 🌱 + AWS_EB_ICON $'\U1F331 ' # 🌱 BACKGROUND_JOBS_ICON $'\UE82F ' #  TEST_ICON $'\UE891' #  TODO_ICON $'\U2611' # ☑ @@ -83,7 +83,7 @@ case $POWERLEVEL9K_MODE in ROOT_ICON $'\uF201' #  RUBY_ICON $'\UF219 ' #  AWS_ICON $'\UF296' #  - AWS_EB_ICON $'\U1F331' # 🌱 + AWS_EB_ICON $'\U1F331 ' # 🌱 BACKGROUND_JOBS_ICON $'\UF013 ' #  TEST_ICON $'\UF291' #  TODO_ICON $'\U2611' # ☑ @@ -132,7 +132,7 @@ case $POWERLEVEL9K_MODE in ROOT_ICON $'\u26A1' # ⚡ RUBY_ICON '' AWS_ICON 'AWS:' - AWS_EB_ICON $'\U1F331' # 🌱 + AWS_EB_ICON $'\U1F331 ' # 🌱 BACKGROUND_JOBS_ICON $'\u2699' # ⚙ TEST_ICON '' TODO_ICON $'\U2611' # ☑ From eba3a3ca95c5bc742ae42e89c9269d5070fb03a6 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sun, 17 Jan 2016 12:38:18 +0100 Subject: [PATCH 4/5] Reworked the AWS Elastic Beanstalk segment. --- powerlevel9k.zsh-theme | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 6ac25d77..f8e75b33 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -291,9 +291,10 @@ prompt_aws() { # Current Elastic Beanstalk environment prompt_aws_eb_env() { - if [ -e .elasticbeanstalk/config.yml ]; then - local eb_env=$(cat .elasticbeanstalk/config.yml | grep environment 2> /dev/null | awk '{print $2}') - "$1_prompt_segment" "$0" black green "$(print_icon 'AWS_EB_ICON') $eb_env" + local eb_env=$(grep environment .elasticbeanstalk/config.yml 2> /dev/null | awk '{print $2}') + + if [[ -n "$eb_env" ]]; then + "$1_prompt_segment" "$0" "$2" black green "$eb_env" 'AWS_EB_ICON' fi } From 45184839f36431c4b6c8bcc42f06cbb4a1ed3204 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sat, 23 Jan 2016 01:39:50 +0100 Subject: [PATCH 5/5] Added changelog entry. --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 816a0dc0..ce0fe494 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v0.4.0 + +### New segment `aws_eb_env` added + +This segment displays the current Elastic Beanstalk environment. + ## v0.3.1 ### `dir` changes