Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [patch] _ed completer
- X-seq: zsh-workers 42981
- From: Matthew Martin <phy1729@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [patch] _ed completer
- Date: Sun, 10 Jun 2018 23:01:34 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=WG1NY1OsEwT1uU7Chom9IdYtxwlcK3f4URq/Bro8AKY=; b=m3quWbqO6HFuExnQj/Uzw4Sb5D18o4oz2CifilWf+k9Tphr5PfmlTMpIWcfJWnEWij cVrNtw7P24LvyDH4H3Xs7X0cemKB+F0J3us8OtyCExNP22QhYZ1okPvUxKJ5GdY0rs0Z lhjxk16nWgBtNOT/qG+1KOpIxMmWpbeD1jc5+X1sUGrG/dYvzmxMsiKzWKCWvWTiuOLM /nIi4WI4VngF99AU3FO7M80nVbCaMiE7acwK2aT/mHRH89mgGX9+ghjEJALHvU2euY99 NS4uR+DTTc9Cl7pqOwakjMeqVT3FJAPn9/eUBD4ZMPJ4M08tTtxuyI5Ui+2oExP0kEcZ 3XTQ==
- In-reply-to: <8785.1525438851@thecus>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mail-followup-to: zsh-workers@xxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20180503032226.GA26793@CptOrmolo.darkstar> <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'
Messages sorted by:
Reverse Date,
Date,
Thread,
Author