Merge pull request #502 from edubxb/aws-plugin
Check for AWS credentials file in AWS pluginpull/503/head
commit
13359fec1c
|
|
@ -4,6 +4,12 @@ about-plugin 'AWS helper functions'
|
||||||
function awskeys {
|
function awskeys {
|
||||||
about 'helper function for AWS credentials file'
|
about 'helper function for AWS credentials file'
|
||||||
group 'aws'
|
group 'aws'
|
||||||
|
|
||||||
|
if [[ ! -f ~/.aws/credentials ]]; then
|
||||||
|
echo "AWS credentials file not found"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $# -eq 1 ]] && [[ "$1" = "list" ]]; then
|
if [[ $# -eq 1 ]] && [[ "$1" = "list" ]]; then
|
||||||
__awskeys_list "$2"
|
__awskeys_list "$2"
|
||||||
elif [[ $# -eq 1 ]] && [[ "$1" = "unset" ]]; then
|
elif [[ $# -eq 1 ]] && [[ "$1" = "unset" ]]; then
|
||||||
|
|
@ -39,8 +45,8 @@ function __awskeys_list {
|
||||||
local credentials_list="$(egrep '^\[ *[a-zA-Z0-9_-]+ *\]$' ~/.aws/credentials)"
|
local credentials_list="$(egrep '^\[ *[a-zA-Z0-9_-]+ *\]$' ~/.aws/credentials)"
|
||||||
if [[ -n $"{credentials_list}" ]]; then
|
if [[ -n $"{credentials_list}" ]]; then
|
||||||
echo -e "Available credentials profiles:\n"
|
echo -e "Available credentials profiles:\n"
|
||||||
for cred in ${credentials_list}; do
|
for profile in ${credentials_list}; do
|
||||||
echo " $(echo ${cred} | tr -d "[]")"
|
echo " $(echo ${profile} | tr -d "[]")"
|
||||||
done
|
done
|
||||||
echo
|
echo
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue