zsh-workers
 help / color / mirror / code / Atom feed
* Missing "--" in the "age" function
@ 2013-05-21 11:53 Stephane Chazelas
  2013-05-21 15:19 ` Peter Stephenson
  0 siblings, 1 reply; 6+ messages in thread
From: Stephane Chazelas @ 2013-05-21 11:53 UTC (permalink / raw)
  To: zsh-workers

$ touch ./-s
$ autoload age
$ ls -ld -- *(e:age today:)
age:zstat:39: no files given
zsh: no matches found: *(e:age today:)

See patch below.

Also, the business about $1/$2 (not $AGEREF/$AGEREF2!) starting
with ":" to mean take the date (not time!) from reference files
seems not to be documented.

Cheers,
Stephane


--- /usr/share/zsh/functions/Calendar/age.back  2013-05-21 12:39:17.702739313 +0100
+++ /usr/share/zsh/functions/Calendar/age       2013-05-21 12:46:52.315052879 +0100
@@ -36,18 +36,18 @@
 local -a vals tmp

 [[ -e $REPLY ]] || return 1
-zstat -A vals +mtime $REPLY || return 1
+zstat -A vals +mtime -- $REPLY || return 1

 if (( $# >= 1 )); then
   if [[ $1 = :* ]]; then
-    zstat -A tmp -F "%Y/%m/%d" +mtime ${1[2,-1]} || return 1
+    zstat -A tmp -F "%Y/%m/%d" +mtime -- ${1#:} || return 1
     local AGEREF=$tmp[1]
   else
     local AGEREF=$1
   fi
   # if 1 argument given, never use globally defined AGEREF2
   if [[ $2 = :* ]]; then
-    zstat -A tmp -F "%Y/%m/%d" +mtime ${2[2,-1]} || return 1
+    zstat -A tmp -F "%Y/%m/%d" +mtime -- ${2#:} || return 1
     local AGEREF2=$tmp[1]
   else
     local AGEREF2=$2


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-05-22 22:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-21 11:53 Missing "--" in the "age" function Stephane Chazelas
2013-05-21 15:19 ` Peter Stephenson
2013-05-21 19:10   ` Stephane Chazelas
2013-05-22  8:46     ` Peter Stephenson
2013-05-22 19:21       ` Stephane Chazelas
2013-05-22 20:00       ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).