From: Matthew Martin <phy1729@gmail.com>
To: zsh-workers@zsh.org
Subject: Re: [patch] _ed completer
Date: Sun, 10 Jun 2018 23:01:34 -0500 [thread overview]
Message-ID: <20180611040133.GA20001@CptOrmolo.darkstar> (raw)
In-Reply-To: <8785.1525438851@thecus>
On Fri, May 04, 2018 at 03:00:51PM +0200, Oliver Kiddle wrote:
> Matthew Martin wrote:
> >
> > +++ b/Completion/Unix/Command/_ed
> > + '(--prompt)'{-p,--prompt}'[specify prompt]:prompt: '
>
> --prompt can exclude a following -p option and it is valid to have the
> prompt immediately after -p or to have --prompt=. So, I think this line
> can be:
> '(-p --prompt)'{-p+,--prompt=}'[specify prompt]:prompt'
>
> > + case $OSTYPE in
> > + dragonfly*|freebsd*|netbsd*)
>
> |solaris*
>
> > +_arguments -s -S -A '-*' \
>
> The -A '-*' option is not applicable to the GNU variant. It's fairly
> common that GNU stuff allows options after normal arguments while
> traditional Unix stuff doesn't.
Thanks for the review and apologies for the long wait. Amended patch
below.
diff --git a/Completion/Unix/Command/_ed b/Completion/Unix/Command/_ed
new file mode 100644
index 000000000..cb206f492
--- /dev/null
+++ b/Completion/Unix/Command/_ed
@@ -0,0 +1,38 @@
+#compdef ed
+
+local -a args
+
+args=(
+ '(-p --prompt)'{-p+,--prompt=}'[specify prompt]:prompt:'
+ '(-s --quiet --silent)'{-s,--quiet,--silent}'[suppress diagnostics]'
+)
+
+if _pick_variant gnu=GNU unix --version; then
+ args+=(
+ '(-G --traditional)'{-G,--traditional}'[run in compatibility mode]'
+ '(- :)'{-h,--help}'[display help]'
+ '(-l --loose-exit-status)'{-l.--loose-exit-status}'[exit 0 even if a command fails]'
+ '(-r --restricted)'{-r,--restricted}'[run in restricted mode]'
+ '(- :)'{-V,--version}'[display version]'
+ '(-v --verbose)'{-v,--verbose}'[be verbose]'
+ )
+else
+ args=(-A '-*' ${args:#*\)--*})
+ case $OSTYPE in
+ dragonfly*|freebsd*|netbsd*|solaris*)
+ args+=(
+ '-x[prompt for an encryption key]'
+ )
+ ;|
+ netbsd*)
+ args+=(
+ '-E[enable extended regular expressions]'
+ '-S[disable ! command]'
+ )
+ ;;
+ esac
+fi
+
+_arguments -s -S \
+ $args \
+ ':file:_files'
next prev parent reply other threads:[~2018-06-11 4:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-03 3:22 Matthew Martin
2018-05-04 13:00 ` Oliver Kiddle
2018-06-11 4:01 ` Matthew Martin [this message]
2018-06-11 4:26 ` Matthew Martin
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=20180611040133.GA20001@CptOrmolo.darkstar \
--to=phy1729@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).