X-Git-Url: https://git.madduck.net/etc/mutt.git/blobdiff_plain/9697fb1471e041b28c583426c7e113e2ea621fa9..cac8e91ad4dd57a2d8c01fe9778a6bc9ca86350a:/.mutt/get-timestamp?ds=sidebyside diff --git a/.mutt/get-timestamp b/.mutt/get-timestamp index 5d00f32..f165be6 100755 --- a/.mutt/get-timestamp +++ b/.mutt/get-timestamp @@ -15,18 +15,20 @@ printf 'When should I tickle you about this message? ' >/dev/tty read timespec &2 + exit 1 + ;; + @[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]) + date="$timespec";; + [0-9][0-9][0-9][0-9][-.][0-9][0-9][-.][0-9][0-9]) date="$timespec";; *[0-9]y) date="now + ${timespec%y} years 00:00";; *[0-9]m) date="now + ${timespec%m} months 00:00";; *[0-9]w) date="now + ${timespec%w} weeks 00:00";; - *[0-9]d) date="now + ${timespec%d} days 00:00";; + *[0-9]d|*[0-9]) date="now + ${timespec%d} days 00:00";; *[0-9]h) date="now + ${timespec%h} hours";; - *[!0-9]*) - echo "E: invalid timespec: $timespec" >&2 - exit 1 - ;; - *) date="now + $timespec days 00:00";; + *) date="$timespec";; esac exec date +'%s (%c)' -d "$date"