Skip to content

Commit

Permalink
Update functions.sh: Make sure ANGLE is output with exactly 6 characters
Browse files Browse the repository at this point in the history
  • Loading branch information
EricClaeys authored Jan 24, 2025
1 parent 0554a58 commit 327902f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -643,18 +643,18 @@ function get_sunrise_sunset()
LATITUDE="$( convertLatLong "${LATITUDE}" "latitude" )" || return 2
LONGITUDE="$( convertLatLong "${LONGITUDE}" "longitude" )" || return 2

local FORMAT="%-15s %-17s %-7s %-10s %-10s\n"
# shellcheck disable=SC2059
printf "${FORMAT}" "Daytime start" "Nighttime start" "Angle" "Latitude" "Longitude"
local FORMAT="%-15s %-17s %6s %-10s %-10s\n"
echo "Daytime start Nighttime start Angle Latitude Longitude"
local STARTS=()
# sunwait output: day_start, night_start
# Need to get rid of the comma.
if [[ ${DO_ZERO} == "true" ]]; then
read -r -a STARTS <<< "$( sunwait list angle "0" "${LATITUDE}" "${LONGITUDE}" )"
# shellcheck disable=SC2059
printf "${FORMAT}" "${STARTS[0]/,/}" "${STARTS[1]}" "0" "${LATITUDE}" "${LONGITUDE}"
printf "${FORMAT}" "${STARTS[0]/,/}" "${STARTS[1]}" " 0.00" "${LATITUDE}" "${LONGITUDE}"
fi
read -r -a STARTS <<< "$( sunwait list angle "${ANGLE}" "${LATITUDE}" "${LONGITUDE}" )"
ANGLE="$( printf "% 2.2f" "${ANGLE}" )"
# shellcheck disable=SC2059
printf "${FORMAT}" "${STARTS[0]/,/}" "${STARTS[1]}" "${ANGLE}" "${LATITUDE}" "${LONGITUDE}"
}
Expand Down

0 comments on commit 327902f

Please sign in to comment.