Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] _pgrep: pkill: fix completion of signals
- X-seq: zsh-workers 42631
- From: Daniel Hahler <genml+zsh-workers@xxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] _pgrep: pkill: fix completion of signals
- Date: Thu, 12 Apr 2018 23:06:27 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thequod.de; h= x-mailer:message-id:date:date:subject:subject:from:from:received :received:received; s=postfix2; t=1523567190; bh=J082Gh1w5LxGAwR wz8hBFXRQaNmLSoEPBMPW6RKJA4E=; b=QCiPrL6p1soAT4IZaa2nO/WwL+0SAvI /DZdvp0bkPe3cWFoHUUevKcFjAMv8x4UtlUeNktBLuC41Eq/GYSKI6Vu5sMIccAm YiICr73dcBtJY6SmrTXQQ2bZ3m9eb46baw5k+4aV/M4vG1BV6fX8ci0PgTA3wTfZ 3p2TYuU5U8Xo=
- 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>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
From: Daniel Hahler <git@xxxxxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author