mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-22 05:40:08 +00:00
Merge pull request #3213 from nikhgupta/features/fix-emoji-clock
added support for GNU version of `date`
This commit is contained in:
commit
7034b01cd1
1 changed files with 16 additions and 12 deletions
|
@ -8,21 +8,25 @@
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
function emoji-clock() {
|
function emoji-clock() {
|
||||||
hour=$(date -v '+15M' '+%I')
|
# Add 15 minutes to the current time and save the value as $minutes.
|
||||||
minutes=$(date -v '+15M' '+%M')
|
(( minutes = $(date '+%M') + 15 ))
|
||||||
|
(( hour = $(date '+%I') + minutes / 60 ))
|
||||||
|
# make sure minutes and hours don't exceed 60 nor 12 respectively
|
||||||
|
(( minutes %= 60 )); (( hour %= 12 ))
|
||||||
|
|
||||||
case $hour in
|
case $hour in
|
||||||
01) clock="🕐"; [ $minutes -ge 30 ] && clock="🕜";;
|
0) clock="🕛"; [ $minutes -ge 30 ] && clock="🕧";;
|
||||||
02) clock="🕑"; [ $minutes -ge 30 ] && clock="🕝";;
|
1) clock="🕐"; [ $minutes -ge 30 ] && clock="🕜";;
|
||||||
03) clock="🕒"; [ $minutes -ge 30 ] && clock="🕞";;
|
2) clock="🕑"; [ $minutes -ge 30 ] && clock="🕝";;
|
||||||
04) clock="🕓"; [ $minutes -ge 30 ] && clock="🕟";;
|
3) clock="🕒"; [ $minutes -ge 30 ] && clock="🕞";;
|
||||||
05) clock="🕔"; [ $minutes -ge 30 ] && clock="🕠";;
|
4) clock="🕓"; [ $minutes -ge 30 ] && clock="🕟";;
|
||||||
06) clock="🕕"; [ $minutes -ge 30 ] && clock="🕡";;
|
5) clock="🕔"; [ $minutes -ge 30 ] && clock="🕠";;
|
||||||
07) clock="🕖"; [ $minutes -ge 30 ] && clock="🕢";;
|
6) clock="🕕"; [ $minutes -ge 30 ] && clock="🕡";;
|
||||||
08) clock="🕗"; [ $minutes -ge 30 ] && clock="🕣";;
|
7) clock="🕖"; [ $minutes -ge 30 ] && clock="🕢";;
|
||||||
09) clock="🕘"; [ $minutes -ge 30 ] && clock="🕤";;
|
8) clock="🕗"; [ $minutes -ge 30 ] && clock="🕣";;
|
||||||
|
9) clock="🕘"; [ $minutes -ge 30 ] && clock="🕤";;
|
||||||
10) clock="🕙"; [ $minutes -ge 30 ] && clock="🕥";;
|
10) clock="🕙"; [ $minutes -ge 30 ] && clock="🕥";;
|
||||||
11) clock="🕚"; [ $minutes -ge 30 ] && clock="🕦";;
|
11) clock="🕚"; [ $minutes -ge 30 ] && clock="🕦";;
|
||||||
12) clock="🕛"; [ $minutes -ge 30 ] && clock="🕧";;
|
|
||||||
*) clock="⌛";;
|
*) clock="⌛";;
|
||||||
esac
|
esac
|
||||||
echo $clock
|
echo $clock
|
||||||
|
|
Loading…
Reference in a new issue