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

[aws] Improve output of aws_cf function

This commit is contained in:
Daniel Carrillo 2020-02-22 16:12:23 +01:00
parent fc8f82329b
commit cb0099ec7a

View File

@ -114,9 +114,15 @@ function aws_ssm_session_any {
function aws_cf { function aws_cf {
local profile=$(_get_aws_profile) local profile=$(_get_aws_profile)
aws cloudfront list-distributions --profile $profile --output ${_aws_output} \ if ! type "jq" > /dev/null; then
echo "ERROR: this function needs jq to be installed"
return 1
fi
aws cloudfront list-distributions --profile $profile --output json \
--query "DistributionList.Items[*].{id:Id,domain:DomainName,status:Status, --query "DistributionList.Items[*].{id:Id,domain:DomainName,status:Status,
origin:Origins.Items[].DomainName | join(' ', @), aliases:Aliases.Items | join(' ', @)}" origin:Origins.Items[].DomainName | join(' ', @), aliases:Aliases.Items | join(' ', @)}" \
| jq -r ".[] | [.id, .domain, .aliases, .status, .origin] | @csv" | tr -d '"' | column --separator="," --table
} }
# ~/.ssh/config # ~/.ssh/config