voidrice/.local/bin/statusbar/moonphase
nerrufam 2eb4f10b84
Updated moonphase (#484)
Now accepts a date as argument, to know pom of a diff date.
Corrected some typos, and a logic error of mine 😄
2020-02-15 20:11:20 -05:00

17 lines
578 B
Bash

#!/bin/sh
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"