diff --git a/say b/say index d0ef16c..03ac552 100755 --- a/say +++ b/say @@ -4,9 +4,11 @@ _usage() { cat < | -t [-n] [-o ] + say [-h] -c | -d | -g | -m | -t [-n] [-o ] -h show this help message + + -c say time -d say date -g godville.net -m custom message @@ -19,7 +21,7 @@ Example: EOF -exit ${1} + exit ${1} } _pluralform(){ @@ -41,6 +43,16 @@ _date() { echo "Сегодня - $( date '+%A' ), $( date2word.lua )." } +_time() { + H=$(( $( date '+%H' ) + 0 )) + M=$(( $( date '+%M' ) + 0 )) + + H="${H} $( _pluralform ${H} час часа часов )" + M="${M} $( _pluralform ${M} минута минуты минут )" + + echo "${H}. ${M}" +} + _godville() { base="https://godville.net/gods/api" god="" @@ -100,18 +112,18 @@ fi NOTIFY="$( which notify-send )" ACTION= -#FILE= DEV= MSG= SEND=0 SUMMARY= -while getopts dghm:no:t: OPT +while getopts cdghm:no:t: OPT do case ${OPT} in - d|g|m|t) + c|d|g|m|t) if [ -z "${ACTION}" ]; then case ${OPT} in + c) ACTION="time" ;; d) ACTION="date" ;; g) ACTION="godville"