From: Daniel Hahler <genml+zsh-workers@thequod.de>
To: zsh-workers@zsh.org
Subject: [PATCH] _pgrep: pkill: fix completion of signals
Date: Thu, 12 Apr 2018 23:06:27 +0200 [thread overview]
Message-ID: <20180412210627.15488-1-genml+zsh-workers@thequod.de> (raw)
From: Daniel Hahler <git@thequod.de>
This adds the signals after arguments are filtered according to
$optchars.
---
Completion/Unix/Command/_pgrep | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/Completion/Unix/Command/_pgrep b/Completion/Unix/Command/_pgrep
index 714bf095b..ec3f8bfd0 100644
--- a/Completion/Unix/Command/_pgrep
+++ b/Completion/Unix/Command/_pgrep
@@ -32,9 +32,7 @@ arguments=('-P[parent process id]:parent process id:->ppid'
'-x[match exactly]'
'-z[match only in zones]:zone:_zones')
-if [[ $service == 'pkill' ]]; then
- arguments+=('-'${^signals}'[signal]')
-elif [[ $service == 'pgrep' ]]; then
+if [[ $service == 'pgrep' ]]; then
arguments+=('-d[output delimiter]:delimiter:compadd ${(s\:\:)IFS}'
'-l[list name in addition to id]')
fi
@@ -64,8 +62,12 @@ case "$OSTYPE" in
optchars="flvxdnoPgsuUGt"
;;
esac
+# Only keep relevant arguments according to $optchars.
arguments=( ${(M)arguments:#(|\*)(|\(*\))-[$optchars]*}
'*:process name:->pname')
+if [[ $service == 'pkill' ]]; then
+ arguments+=('-'${^signals}'[signal]')
+fi
_arguments -C -s -w $arguments && ret=0
--
2.17.0
reply other threads:[~2018-04-12 21:12 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20180412210627.15488-1-genml+zsh-workers@thequod.de \
--to=genml+zsh-workers@thequod.de \
--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).