zsh-workers
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <stephane.chazelas@gmail.com>
To: zsh-workers@zsh.org
Subject: Missing "--" in the "age" function
Date: Tue, 21 May 2013 12:53:32 +0100	[thread overview]
Message-ID: <20130521115332.GA9976@chaz.gmail.com> (raw)

$ 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


             reply	other threads:[~2013-05-21 13:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-21 11:53 Stephane Chazelas [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130521115332.GA9976@chaz.gmail.com \
    --to=stephane.chazelas@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).