mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-05 01:46:46 +01:00
Fix code style issues in aws-cost function
- Remove trailing spaces - Fix inconsistent spacing between code blocks - Ensure proper blank line spacing throughout function - Maintain consistency with existing codebase style
This commit is contained in:
parent
2ce9a1bfc7
commit
913414b3fd
1 changed files with 11 additions and 11 deletions
|
|
@ -255,8 +255,8 @@ function aws-cost() {
|
||||||
local start_date="$1"
|
local start_date="$1"
|
||||||
local end_date="$2"
|
local end_date="$2"
|
||||||
local granularity="${3:-DAILY}"
|
local granularity="${3:-DAILY}"
|
||||||
|
|
||||||
aws ce get-cost-and-usage \
|
aws ce get-cost-and-usage \
|
||||||
--time-period Start="$start_date",End="$end_date" \
|
--time-period Start="$start_date",End="$end_date" \
|
||||||
--granularity "$granularity" \
|
--granularity "$granularity" \
|
||||||
--metrics BlendedCost \
|
--metrics BlendedCost \
|
||||||
|
|
@ -290,7 +290,7 @@ function aws-cost() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
month_cost=$(get_cost "$month_start" "$today" "MONTHLY")
|
month_cost=$(get_cost "$month_start" "$today" "MONTHLY")
|
||||||
|
|
||||||
if [[ -n "$last_month_start" && -n "$last_month_end" ]]; then
|
if [[ -n "$last_month_start" && -n "$last_month_end" ]]; then
|
||||||
last_month_cost=$(get_cost "$last_month_start" "$last_month_end" "MONTHLY")
|
last_month_cost=$(get_cost "$last_month_start" "$last_month_end" "MONTHLY")
|
||||||
fi
|
fi
|
||||||
|
|
@ -306,21 +306,21 @@ function aws-cost() {
|
||||||
echo "┌─────────────┬─────────────┬─────────────┐"
|
echo "┌─────────────┬─────────────┬─────────────┐"
|
||||||
echo "│ Period │ Amount │ Change │"
|
echo "│ Period │ Amount │ Change │"
|
||||||
echo "├─────────────┼─────────────┼─────────────┤"
|
echo "├─────────────┼─────────────┼─────────────┤"
|
||||||
|
|
||||||
if [[ -n "$yesterday" ]]; then
|
if [[ -n "$yesterday" ]]; then
|
||||||
printf "│ Yesterday │ $%8s │ - │\n" "$yesterday_cost"
|
printf "│ Yesterday │ $%8s │ - │\n" "$yesterday_cost"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "$week_ago" ]]; then
|
if [[ -n "$week_ago" ]]; then
|
||||||
printf "│ Last 7 days │ $%8s │ - │\n" "$week_cost"
|
printf "│ Last 7 days │ $%8s │ - │\n" "$week_cost"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "│ This month │ $%8s │ $%+8s │\n" "$month_cost" "$month_change"
|
printf "│ This month │ $%8s │ $%+8s │\n" "$month_cost" "$month_change"
|
||||||
|
|
||||||
if [[ -n "$last_month_start" && -n "$last_month_end" ]]; then
|
if [[ -n "$last_month_start" && -n "$last_month_end" ]]; then
|
||||||
printf "│ Last month │ $%8s │ - │\n" "$last_month_cost"
|
printf "│ Last month │ $%8s │ - │\n" "$last_month_cost"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "└─────────────┴─────────────┴─────────────┘"
|
echo "└─────────────┴─────────────┴─────────────┘"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
|
@ -332,10 +332,10 @@ function aws-cost() {
|
||||||
|
|
||||||
local services_data
|
local services_data
|
||||||
services_data=$(get_cost_by_service)
|
services_data=$(get_cost_by_service)
|
||||||
|
|
||||||
if [[ -n "$services_data" ]]; then
|
if [[ -n "$services_data" ]]; then
|
||||||
local total_month_cost_num=$(echo "$month_cost" | bc -l 2>/dev/null || echo "0")
|
local total_month_cost_num=$(echo "$month_cost" | bc -l 2>/dev/null || echo "0")
|
||||||
|
|
||||||
echo "$services_data" | while read -r service cost; do
|
echo "$services_data" | while read -r service cost; do
|
||||||
if [[ -n "$service" && -n "$cost" ]]; then
|
if [[ -n "$service" && -n "$cost" ]]; then
|
||||||
local percentage="0.0"
|
local percentage="0.0"
|
||||||
|
|
@ -348,7 +348,7 @@ function aws-cost() {
|
||||||
else
|
else
|
||||||
echo "│ No data available │ - │ - │"
|
echo "│ No data available │ - │ - │"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "└─────────────────┴─────────────┴─────────────┘"
|
echo "└─────────────────┴─────────────┴─────────────┘"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue