zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: zsh-workers@zsh.org
Subject: PATCH: _strftime: Update with -n and make 2: dynamic on -r
Date: Sat, 24 Oct 2020 15:32:20 +0200	[thread overview]
Message-ID: <20201024133220.17191-1-mikachu@gmail.com> (raw)
In-Reply-To: <20201024114609.12293-1-mikachu@gmail.com>

---
 Completion/Zsh/Command/_strftime | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/Completion/Zsh/Command/_strftime b/Completion/Zsh/Command/_strftime
index 0849f1c85c..a57a76ce44 100644
--- a/Completion/Zsh/Command/_strftime
+++ b/Completion/Zsh/Command/_strftime
@@ -1,14 +1,16 @@
 #compdef strftime
 
-local ret=1 expl
+local expl two='epoch time'
+
+if (( words[(I)-r] )); then
+  two='date string'
+fi
 
 _arguments -S -A '-*' -s \
+  '-n[omit trailing newline]' \
   '-q[run quietly]' \
   '(3)-r[reverse lookup using strptime]' \
   '-s+[assign result to parameter]:param:_parameters' \
   '1:format: _date_formats zsh' \
-  '2:epoch time (or date string with -r)' \
+  "2:$two" \
   '3:nanoseconds' \
-&& ret=0
-
-return ret
-- 
2.15.1



      reply	other threads:[~2020-10-24 13:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-24 11:46 PATCH: Add -n option to strftime Mikael Magnusson
2020-10-24 13:32 ` Mikael Magnusson [this message]

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=20201024133220.17191-1-mikachu@gmail.com \
    --to=mikachu@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).