diff options
author | Daniel Hahler <git@thequod.de> | 2018-04-12 18:55:41 +0200 |
---|---|---|
committer | Daniel Hahler <git@thequod.de> | 2018-04-13 11:44:37 +0200 |
commit | 5bd659352fff6d8d7d2b70af28fea756f6d84582 (patch) | |
tree | 94ea5aa973f2f71362593eb9403d561b663f363f | |
parent | 65b265f3c0877823b72ffff6ba1083972c49a3a8 (diff) | |
download | zsh-5bd659352fff6d8d7d2b70af28fea756f6d84582.tar.gz zsh-5bd659352fff6d8d7d2b70af28fea756f6d84582.tar.xz zsh-5bd659352fff6d8d7d2b70af28fea756f6d84582.zip |
42631: _pgrep: pkill: fix completion of signals
This adds the signals after arguments are filtered according to $optchars.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | Completion/Unix/Command/_pgrep | 8 |
2 files changed, 10 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog index 949fdda57..72b1ebaad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2018-04-13 Daniel Hahler <zsh@thequod.de> + + * 42631: Completion/Unix/Command/_pgrep: _pgrep: pkill: fix completion + of signals. + 2018-04-12 Oliver Kiddle <okiddle@yahoo.co.uk> * 42624 (plus test): Src/exec.c, Test/C04funcdef.ztst: avoid 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 |