about summary refs log tree commit diff
path: root/Functions/Calendar/age
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2009-02-11 17:57:56 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-02-11 17:57:56 +0000
commitf2dd38acc1001b06f7aab600c8d89b61f16d37ff (patch)
tree78755e977f6c80cd5b5fae0d3ac70857f1649095 /Functions/Calendar/age
parent76f05a9932c5f9aa1ea7ea7bd1cf08f65fd43e7c (diff)
downloadzsh-f2dd38acc1001b06f7aab600c8d89b61f16d37ff.tar.gz
zsh-f2dd38acc1001b06f7aab600c8d89b61f16d37ff.tar.xz
zsh-f2dd38acc1001b06f7aab600c8d89b61f16d37ff.zip
Richard Hartmann: 26550: document unchangeable options better
Diffstat (limited to 'Functions/Calendar/age')
-rw-r--r--Functions/Calendar/age18
1 files changed, 14 insertions, 4 deletions
diff --git a/Functions/Calendar/age b/Functions/Calendar/age
index d47f975ad..160aae4a8 100644
--- a/Functions/Calendar/age
+++ b/Functions/Calendar/age
@@ -33,19 +33,29 @@ zmodload -i zsh/parameter
 
 autoload -U calendar_scandate
 
-local -a vals
+local -a vals tmp
 
 [[ -e $REPLY ]] || return 1
 zstat -A vals +mtime $REPLY || return 1
 
 if (( $# >= 1 )); then
-  local AGEREF=$1
+  if [[ $1 = :* ]]; then
+    zstat -A tmp -F "%Y/%m/%d" +mtime ${1[2,-1]} || return 1
+    local AGEREF=$tmp[1]
+  else
+    local AGEREF=$1
+  fi
   # if 1 argument given, never use globally defined AGEREF2
-  local AGEREF2=$2
+  if [[ $2 = :* ]]; then
+    zstat -A tmp -F "%Y/%m/%d" +mtime ${2[2,-1]} || return 1
+    local AGEREF2=$tmp[1]
+  else
+    local AGEREF2=$2
+  fi
 fi
 
 integer mtime=$vals[1] date1 date2
-local REPLY
+local REPLY REPLY2
 
 # allow a time only (meaning today)
 if calendar_scandate -t $AGEREF; then