From 8b41eb3fa0829f1347df7969b0ffecffe88a9901 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 22 Mar 2007 23:52:26 +0000 Subject: 23228: calendar tweaks, including summer time adjustment --- Functions/Calendar/calendar_showdate | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'Functions/Calendar/calendar_showdate') diff --git a/Functions/Calendar/calendar_showdate b/Functions/Calendar/calendar_showdate index b35a0a91f..69588da4f 100644 --- a/Functions/Calendar/calendar_showdate +++ b/Functions/Calendar/calendar_showdate @@ -1,19 +1,24 @@ emulate -L zsh setopt extendedglob +zmodload -i zsh/datetime -local optm datefmt +local optm datefmt opt integer optr replyset zstyle -s ':datetime:calendar_showdate:' date-format datefmt || datefmt="%a %b %d %H:%M:%S %Z %Y" -if [[ $1 = -r ]]; then - shift - REPLY=0 - optr=1 -else - local REPLY -fi +while [[ $argv[$OPTIND] != +* ]] && getopts "r" opt; do + case $opt in + (r) + REPLY=0 + optr=1 + ;; + esac +done +shift $(( OPTIND - 1 )) + +(( optr )) || local REPLY if (( ! $# )); then print "Usage: $0 datespec [ ... ]" >&2 -- cgit 1.4.1