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() { _usage() {
cat <<EOF cat <<EOF
Usage: 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 -h show this help message
-c say time
-d say date -d say date
-g godville.net -g godville.net
-m custom message -m custom message
@ -19,7 +21,7 @@ Example:
EOF EOF
exit ${1} exit ${1}
} }
_pluralform(){ _pluralform(){
@ -41,6 +43,16 @@ _date() {
echo "Сегодня - $( date '+%A' ), $( date2word.lua )." 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() { _godville() {
base="https://godville.net/gods/api" base="https://godville.net/gods/api"
god="" god=""
@ -100,18 +112,18 @@ fi
NOTIFY="$( which notify-send )" NOTIFY="$( which notify-send )"
ACTION= ACTION=
#FILE=
DEV= DEV=
MSG= MSG=
SEND=0 SEND=0
SUMMARY= SUMMARY=
while getopts dghm:no:t: OPT while getopts cdghm:no:t: OPT
do do
case ${OPT} in case ${OPT} in
d|g|m|t) c|d|g|m|t)
if [ -z "${ACTION}" ]; then if [ -z "${ACTION}" ]; then
case ${OPT} in case ${OPT} in
c) ACTION="time" ;;
d) ACTION="date" ;; d) ACTION="date" ;;
g) g)
ACTION="godville" ACTION="godville"

Loading…
Cancel
Save