about summary refs log tree commit diff
path: root/Functions/Calendar/calendar_showdate
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-03-22 23:52:26 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-03-22 23:52:26 +0000
commit8b41eb3fa0829f1347df7969b0ffecffe88a9901 (patch)
tree55bf59f6a0a0331adfe28c4dcd3635a05cd4c02f /Functions/Calendar/calendar_showdate
parentfcbb417504f06a61177f27259a165ef8598ca536 (diff)
downloadzsh-8b41eb3fa0829f1347df7969b0ffecffe88a9901.tar.gz
zsh-8b41eb3fa0829f1347df7969b0ffecffe88a9901.tar.xz
zsh-8b41eb3fa0829f1347df7969b0ffecffe88a9901.zip
23228: calendar tweaks, including summer time adjustment
Diffstat (limited to 'Functions/Calendar/calendar_showdate')
-rw-r--r--Functions/Calendar/calendar_showdate21
1 files changed, 13 insertions, 8 deletions
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