Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions plugins/aws/aws.plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@
# command 'asp' sets the AWS profile to use (aws set profile)
#

export AWS_HOME=~/.aws

function agp {
echo $AWS_DEFAULT_PROFILE
echo $AWS_PROFILE
}

function asp {
local rprompt=${RPROMPT/<aws:$(agp)>/}

export AWS_DEFAULT_PROFILE=$1
export AWS_PROFILE=$1
}

function _aws_profiles {
grep '\[profile' ~/.aws/config \
| grep -v '^[[:space:]]*#' \
| tr -d '\[\]' \
| awk '{print $2}'
}

complete -W "$(_aws_profiles)" asp