mirror of
https://github.com/akelge/zsh
synced 2025-07-03 05:05:28 +00:00
Update starship and awsprofile
This commit is contained in:
@ -1,4 +1,7 @@
|
||||
profile=$1
|
||||
shift
|
||||
region=${1:-""}
|
||||
|
||||
|
||||
if [ ! -f ~/.aws/config ]; then
|
||||
echo "no aws config file found, bailing out..."
|
||||
@ -18,9 +21,12 @@ if [ $profile ]; then # We got a profile pattern, look for a match
|
||||
fi
|
||||
|
||||
if [ $match ]; then # Single match, setting profile
|
||||
print -P "$FX[bold]activating profile $FG[075]$match$FX[reset]"
|
||||
export AWS_CLI_AUTO_PROMPT=on
|
||||
export AWS_DEFAULT_PROFILE=$match
|
||||
export AWS_DEFAULT_REGION=$(aws configure get region)
|
||||
export AWS_PROFILE=$match
|
||||
export AWS_REGION=${region:-$AWS_DEFAULT_REGION}
|
||||
print -P "$FX[bold]activating profile $FG[075]$match$FX[reset] $FX[bold] on region $FG[075]$AWS_REGION$FX[reset]"
|
||||
return
|
||||
else
|
||||
print -P "$FX[bold]$FG[009]no match for $profile$FX[reset]"
|
||||
@ -28,7 +34,7 @@ if [ $profile ]; then # We got a profile pattern, look for a match
|
||||
fi
|
||||
|
||||
elif [ $AWS_PROFILE ]; then # no profile passed, clean up current one, logout
|
||||
unset AWS_DEFAULT_PROFILE AWS_PROFILE
|
||||
unset AWS_DEFAULT_PROFILE AWS_PROFILE AWS_DEFAULT_REGION AWS_REGION
|
||||
print -P "$FX[bold]profile cleared$FX[reset]."
|
||||
return
|
||||
fi
|
||||
|
Reference in New Issue
Block a user