X-Git-Url: https://git.madduck.net/etc/mutt.git/blobdiff_plain/616f061f77605ce342e3068e5aacda3dffa24710..38db3f07c75080aee66486fe0dee7700b00685aa:/.mutt/get-timestamp diff --git a/.mutt/get-timestamp b/.mutt/get-timestamp index 4a1c524..18a7049 100755 --- a/.mutt/get-timestamp +++ b/.mutt/get-timestamp @@ -7,22 +7,26 @@ # set -eu +if [ -z "${__RLWRAPPED:-}" ] && [ -x $(command -v rlwrap) ]; then + __RLWRAPPED=true exec rlwrap "$0" "$@" +fi + 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]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"