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 😄
This commit is contained in:
nerrufam 2020-02-16 02:11:20 +01:00 committed by GitHub
parent 8d4a021f37
commit 2eb4f10b84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,18 +1,17 @@
#!/bin/sh #!/bin/sh
mnphs=$(pom | grep -io 'new\|waxing cresent\|first quarter\|waxing gibbous\|full\|waning gibbous\|last quarter\|waning cresent' | grep -m1 '.') mnphs=$(pom $1 | grep -o 'New\|Waxing Crescent\|First Quarter\|Waxing Gibbous\|Full\|Waning Gibbous\|Last Quarter\|Waning Crescent' | grep -m1 '.')
prcnt=$(pom | grep -o '..%') prcnt=$(pom $1 | grep -o '[[:digit:]]*%')
case "$mnphs" in
case $mnphs in "New") icon="🌑" prcnt="0%" ;;
"New") icon="🌑" ;; "Waxing Crescent") icon="🌒" ;;
"Waxing Cresent") icon="🌒" ;; "First Quarter") icon="🌓" prcnt="50%" ;;
"First Quarter") icon="🌓" ;; "Waxing Gibbous") icon="🌔" ;;
"Waxing Gibbous") icon="🌔" ;; "Full") icon="🌕" prcnt="100%" ;;
"Full") icon="🌕" ;; "Waning Gibbous") icon="🌖" ;;
"Waning Gibbous") icon="🌖" ;; "Last Quarter") icon="🌗" prcnt="50%" ;;
"Last Quarter") icon="🌗" ;; "Waning Crescent") icon="🌘" ;;
"Waning Cresent") icon="🌘" ;; *) echo errorrrr ;;
*) echo errorrrr ;;
esac esac
printf "%s %s\\n" "$icon" "$prcnt" printf "%s %s\\n" "$icon" "$prcnt"