zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] _pgrep: pkill: fix completion of signals
@ 2018-04-12 21:06 Daniel Hahler
  0 siblings, 0 replies; only message in thread
From: Daniel Hahler @ 2018-04-12 21:06 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-04-12 21:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-12 21:06 [PATCH] _pgrep: pkill: fix completion of signals Daniel Hahler

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).