From 2eb4f10b84c3918c178675a5d32cc457209a38f9 Mon Sep 17 00:00:00 2001 From: nerrufam <58603397+nerrufam@users.noreply.github.com> Date: Sun, 16 Feb 2020 02:11:20 +0100 Subject: [PATCH] Updated moonphase (#484) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now accepts a date as argument, to know pom of a diff date. Corrected some typos, and a logic error of mine 😄 --- .local/bin/statusbar/moonphase | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/.local/bin/statusbar/moonphase b/.local/bin/statusbar/moonphase index 6ccc81b..d2bbad6 100644 --- a/.local/bin/statusbar/moonphase +++ b/.local/bin/statusbar/moonphase @@ -1,18 +1,17 @@ #!/bin/sh -mnphs=$(pom | grep -io 'new\|waxing cresent\|first quarter\|waxing gibbous\|full\|waning gibbous\|last quarter\|waning cresent' | grep -m1 '.') -prcnt=$(pom | grep -o '..%') - -case $mnphs in - "New") icon="🌑" ;; - "Waxing Cresent") icon="🌒" ;; - "First Quarter") icon="🌓" ;; - "Waxing Gibbous") icon="🌔" ;; - "Full") icon="🌕" ;; - "Waning Gibbous") icon="🌖" ;; - "Last Quarter") icon="🌗" ;; - "Waning Cresent") icon="🌘" ;; - *) echo errorrrr ;; +mnphs=$(pom $1 | grep -o 'New\|Waxing Crescent\|First Quarter\|Waxing Gibbous\|Full\|Waning Gibbous\|Last Quarter\|Waning Crescent' | grep -m1 '.') +prcnt=$(pom $1 | grep -o '[[:digit:]]*%') +case "$mnphs" in + "New") icon="🌑" prcnt="0%" ;; + "Waxing Crescent") icon="🌒" ;; + "First Quarter") icon="🌓" prcnt="50%" ;; + "Waxing Gibbous") icon="🌔" ;; + "Full") icon="🌕" prcnt="100%" ;; + "Waning Gibbous") icon="🌖" ;; + "Last Quarter") icon="🌗" prcnt="50%" ;; + "Waning Crescent") icon="🌘" ;; + *) echo errorrrr ;; esac printf "%s %s\\n" "$icon" "$prcnt"