1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-12-22 12:48:01 +00:00

[aws] Add function for deactivating (unset variables) current aws profile

This commit is contained in:
Daniel Carrillo 2020-02-22 20:04:40 +01:00
parent a73bb314cc
commit 272528b439

View File

@ -135,9 +135,14 @@ function ssh_aws_any {
} }
function aws_switch_profile { function aws_switch_profile {
echo "Activating profile $1..."
local region local region
if [[ -z $1 ]]; then
echo "Profile can't be an empty string"
return 1
fi
echo "Activating profile $1..."
export AWS_PROFILE=$1 export AWS_PROFILE=$1
if [[ -f ~/.aws/credentials ]]; then #&& (( ! ${+AWS_DEFAULT_REGION} )) if [[ -f ~/.aws/credentials ]]; then #&& (( ! ${+AWS_DEFAULT_REGION} ))
region=$(aws configure get region) region=$(aws configure get region)
@ -148,3 +153,9 @@ function aws_switch_profile {
fi fi
fi fi
} }
function aws_deactivate_profile {
echo "Deactivating aws profile..."
unset AWS_PROFILE
unset AWS_DEFAULT_REGION
}