From 807ccbaa1520197f18484b17bf252418a77bcbdc Mon Sep 17 00:00:00 2001 From: Eric Claeys <83164203+EricClaeys@users.noreply.github.com> Date: Sun, 4 Aug 2024 12:33:40 -0600 Subject: [PATCH] Update functions.sh: Accept --zero argument --- scripts/functions.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/functions.sh b/scripts/functions.sh index 92fb4b65e..5e2572556 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -581,6 +581,12 @@ function convertLatLong() # to allow testing various configurations. function get_sunrise_sunset() { + local DO_ZERO="false" + if [[ ${1} == "--zero" ]]; then + DO_ZERO="true" + shift + fi + local ANGLE="${1}" local LATITUDE="${2}" local LONGITUDE="${3}" @@ -595,9 +601,11 @@ function get_sunrise_sunset() LONGITUDE="$( convertLatLong "${LONGITUDE}" "longitude" )" || return 2 echo "Daytime start Nighttime start Angle" - local X="$( sunwait list angle "0" "${LATITUDE}" "${LONGITUDE}" )" - # Replace comma by several spaces so the output lines up. - echo "${X/,/ } 0" + if [[ ${DO_ZERO} == "true" ]]; then + local X="$( sunwait list angle "0" "${LATITUDE}" "${LONGITUDE}" )" + # Replace comma by several spaces so the output lines up. + echo "${X/,/ } 0" + fi X="$( sunwait list angle "${ANGLE}" "${LATITUDE}" "${LONGITUDE}" )" echo "${X/,/ } ${ANGLE}" }