zsh-workers
 help / color / mirror / 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
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

zsh-workers

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/zsh-workers

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 zsh-workers zsh-workers/ http://inbox.vuxu.org/zsh-workers \
		zsh-workers@zsh.org
	public-inbox-index zsh-workers

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


code repositories for the project(s) associated with this inbox:

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

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git