Browse Source

Added _time function to say script which says the current time

master
Sergey Kiselev 9 months ago
parent
commit
e81d5a225f
  1. 22
      say

22
say

@ -4,9 +4,11 @@
_usage() {
cat <<EOF
Usage:
say [-h] -d | -g | -m <message> | -t <dev> [-n] [-o <file>]
say [-h] -c | -d | -g | -m <message> | -t <dev> [-n] [-o <file>]
-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"

Loading…
Cancel
Save