From 90021ef4f4e5bc3d78ee7fc2f058dac307e34dcf Mon Sep 17 00:00:00 2001 From: Eduardo Bellido Bellido Date: Sun, 10 May 2015 23:46:00 +0200 Subject: [PATCH 1/4] Fixed export option to work on Mac --- plugins/available/aws.plugin.bash | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/available/aws.plugin.bash b/plugins/available/aws.plugin.bash index 68fc4907..b9873359 100644 --- a/plugins/available/aws.plugin.bash +++ b/plugins/available/aws.plugin.bash @@ -61,9 +61,12 @@ function __awskeys_show { } function __awskeys_export { - local p_keys="$(__awskeys_get $1)" + local p_keys=( $(__awskeys_get $1 | tr -d " ") ) if [[ -n "${p_keys}" ]]; then - eval $(echo "${p_keys}" | tr -d " " | sed -r -e "s/(.+=)(.+)/export \U\1\E\2/") + for p_key in ${p_keys[@]}; do + local key="${p_key%=*}" + export "${key^^}=${p_key#*=}" + done export AWS_DEFAULT_PROFILE="$1" else echo "Profile $1 not found in credentials file" From b5dd60f79da5abe4eef0dd309271ac485cff06d0 Mon Sep 17 00:00:00 2001 From: Eduardo Bellido Bellido Date: Sun, 10 May 2015 23:49:47 +0200 Subject: [PATCH 2/4] Minor changes and updated help messages --- plugins/available/aws.plugin.bash | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/plugins/available/aws.plugin.bash b/plugins/available/aws.plugin.bash index b9873359..fa194077 100644 --- a/plugins/available/aws.plugin.bash +++ b/plugins/available/aws.plugin.bash @@ -4,18 +4,12 @@ about-plugin 'AWS helper functions' function awskeys { about 'helper function for AWS credentials file' group 'aws' - if [[ $# -eq 0 ]]; then - __awskeys_help - elif [[ $# -eq 1 ]] && [[ "$1" = "list" ]]; then + if [[ $# -eq 1 ]] && [[ "$1" = "list" ]]; then __awskeys_list "$2" - elif [[ $# -eq 2 ]]; then - if [[ "$1" = "show" ]]; then - __awskeys_show "$2" - elif [[ "$1" = "export" ]]; then - __awskeys_export "$2" - else - __awskeys_help - fi + elif [[ $# -eq 2 ]] && [[ "$1" = "show" ]]; then + __awskeys_show "$2" + elif [[ $# -eq 2 ]] && [[ "$1" = "export" ]]; then + __awskeys_export "$2" else __awskeys_help fi @@ -26,9 +20,9 @@ function __awskeys_help { echo -e "Helper to AWS credentials file.\n" echo -e "Commands:\n" echo " help Show this help message" - echo " list List available credentials profiles" - echo " show Show the keys associated to a credentials profile" - echo " export Export a credentials profile keys as environment variables" + echo " list List available AWS credentials profiles" + echo " show Show the AWS keys associated to a credentials profile" + echo " export Export an AWS credentials profile keys as environment variables" } function __awskeys_get { From 71ebee2a9662825f3d780192c8d2d3c7a8fa374a Mon Sep 17 00:00:00 2001 From: Eduardo Bellido Bellido Date: Sun, 10 May 2015 23:50:18 +0200 Subject: [PATCH 3/4] Added remove option --- plugins/available/aws.plugin.bash | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/available/aws.plugin.bash b/plugins/available/aws.plugin.bash index fa194077..d434f876 100644 --- a/plugins/available/aws.plugin.bash +++ b/plugins/available/aws.plugin.bash @@ -6,6 +6,8 @@ function awskeys { group 'aws' if [[ $# -eq 1 ]] && [[ "$1" = "list" ]]; then __awskeys_list "$2" + elif [[ $# -eq 1 ]] && [[ "$1" = "remove" ]]; then + __awskeys_remove "$2" elif [[ $# -eq 2 ]] && [[ "$1" = "show" ]]; then __awskeys_show "$2" elif [[ $# -eq 2 ]] && [[ "$1" = "export" ]]; then @@ -23,6 +25,7 @@ function __awskeys_help { echo " list List available AWS credentials profiles" echo " show Show the AWS keys associated to a credentials profile" echo " export Export an AWS credentials profile keys as environment variables" + echo " remove Remove the AWS keys variables from the environment" } function __awskeys_get { @@ -67,3 +70,8 @@ function __awskeys_export { fi } +function __awskeys_remove { + unset AWS_DEFAULT_PROFILE + unset AWS_ACCESS_KEY_ID + unset AWS_SECRET_ACCESS_KEY +} From 16e2b5b1e55beeab02ffe0f3ce2d2dd54af43ce3 Mon Sep 17 00:00:00 2001 From: Fahad Hossain Date: Wed, 6 May 2015 22:37:24 +0600 Subject: [PATCH 4/4] Fix unicode line wrap problem (issue #409) Fix unicode line wrap issue mentioned in #409 Nota bene, This fixed the problem for me on Fedora 21 and Ubuntu 15.04 Needs to be tested on other systems --- bash_it.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash_it.sh b/bash_it.sh index 0416306f..21445034 100755 --- a/bash_it.sh +++ b/bash_it.sh @@ -71,7 +71,7 @@ done unset config_file if [[ $PROMPT ]]; then - export PS1=$PROMPT + export PS1="\["$PROMPT"\]" fi # Adding Support for other OSes