From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: [PATCH 2/2] ___arguments: New completion function for __arguments.
Date: Thu, 1 Apr 2021 00:00:26 +0000 [thread overview]
Message-ID: <20210401000026.23570-2-danielsh@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <20210401000026.23570-1-danielsh@tarpaulin.shahaf.local2>
The new function, ___arguments, would not be called by _default by
default, nor by _nothing, nor by nothing, but by _normal — at least,
if the normal _normal _setup setup is used.
___arguments could also have completed __arguments by calling _arguments
without arguments, but then nothing would have printed the "no argument or
option" message that _nothing prints.
I assume the decision to have ___arguments as a separate file, rather
than simply add something to _nothing or have __arguments complete its
own (__arguments') arguments by changing its first line from "#compdef
_arguments" to "#compdef _arguments __arguments", may be somewhat
controversial. However, while there are good arguments both for having
__arguments completed by __arguments and for having __arguments
completed by ___arguments, let us please have no long arguments about
whether __arguments should be completed by __arguments or by
___arguments. My argument is that a complex argument about whether
__arguments or ___arguments should complete __arguments' arguments would
take time and tuits away from reviewing the arguments to the _arguments
calls in __arguments' completion of the arguments to _arguments; that
is: from reviewing the arguments to __arguments' _arguments _arguments'
arguments completion calls.
Review-by: Matthew Martin
Thanks-to: comm -12 /usr/share/dict/words =(() { print -o -raC1 -- ${${@:t}#_} } Completion/{Base,Zsh}/**/_*(N) | uniq)
---
Completion/Zsh/Function/___arguments | 11 +++++++++++
Completion/Zsh/Function/__arguments | 2 +-
2 files changed, 12 insertions(+), 1 deletion(-)
create mode 100644 Completion/Zsh/Function/___arguments
diff --git a/Completion/Zsh/Function/___arguments b/Completion/Zsh/Function/___arguments
new file mode 100644
index 000000000..187ae644c
--- /dev/null
+++ b/Completion/Zsh/Function/___arguments
@@ -0,0 +1,11 @@
+#compdef __arguments ___arguments
+
+# Dear reader: This is the function ___arguments. This function is the
+# completion function of the completion function of the completion utility
+# function _arguments. If you're looking for the completion utility function
+# _arguments or for its completion function __arguments, whose completion
+# function is this function, then you've come to the wrong place. See
+# ./__arguments for __arguments and for pointers to _arguments.
+
+# Unlike _arguments, __arguments and ___arguments take no arguments.
+_nothing
diff --git a/Completion/Zsh/Function/__arguments b/Completion/Zsh/Function/__arguments
index 40a4e4b60..444a1c809 100644
--- a/Completion/Zsh/Function/__arguments
+++ b/Completion/Zsh/Function/__arguments
@@ -16,7 +16,7 @@
# source code, that'd be either in ../../../Completion/Base/Utility/_arguments
# or in ./_arguments, depending on where you're reading this file.
#
-# __arguments takes no arguments.
+# __arguments takes no arguments, as ___arguments would tell you.
if (( ${words[(i)--]} < CURRENT )); then
# "Deriving spec forms from the help output"
next prev parent reply other threads:[~2021-04-01 0:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-01 0:00 [PATCH 1/2] __arguments: New completion function for _arguments Daniel Shahaf
2021-04-01 0:00 ` Daniel Shahaf [this message]
2021-04-01 12:53 ` Oliver Kiddle
2021-04-01 17:33 ` Daniel Shahaf
2021-04-01 22:34 ` _arguments -n / $NORMARG (was: Re: [PATCH 1/2] __arguments: New completion function for _arguments.) Daniel Shahaf
2021-04-09 19:24 ` Oliver Kiddle
2021-04-09 22:52 ` Daniel Shahaf
2021-04-02 23:58 ` [PATCH 1/2] __arguments: New completion function for _arguments Oliver Kiddle
2021-04-10 20:41 ` Lawrence Velázquez
2021-04-13 11:28 ` Daniel Shahaf
2021-04-17 12:25 ` Daniel Shahaf
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=20210401000026.23570-2-danielsh@tarpaulin.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--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).