diff options
author | Marlon Richert <marlon.richert@gmail.com> | 2021-05-21 15:56:42 +0300 |
---|---|---|
committer | Oliver Kiddle <opk@zsh.org> | 2021-05-21 23:50:24 +0200 |
commit | 891d361572f6db01434c21adb9b699d6a82dba80 (patch) | |
tree | 1729a809a389729ea79768de5551166565f0ea69 /Completion | |
parent | e7320734153829e8bc94c1255bdeba724e13e8b6 (diff) | |
download | zsh-891d361572f6db01434c21adb9b699d6a82dba80.tar.gz zsh-891d361572f6db01434c21adb9b699d6a82dba80.tar.xz zsh-891d361572f6db01434c21adb9b699d6a82dba80.zip |
48891: Fix pgrep/pkill -f completion
Old completion produced false positives & took too much screen space.
Diffstat (limited to 'Completion')
-rw-r--r-- | Completion/Unix/Command/_pgrep | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Completion/Unix/Command/_pgrep b/Completion/Unix/Command/_pgrep index 51a4883df..5b1853e6b 100644 --- a/Completion/Unix/Command/_pgrep +++ b/Completion/Unix/Command/_pgrep @@ -166,8 +166,15 @@ case $state in ispat="" fi if (( ${+opt_args[-f]} )); then - _wanted process-args expl $ispat'process command line' \ - compadd ${${(f)"$(_call_program process-args ps -A -o args=)"}% *} + local -a matches=( ${(f)"$( + _call_program process-args pgrep -lf ${${:-$PREFIX$SUFFIX}:-.\*} + )"} ) + local -a displ=( "${${matches[@]//':'/'\:'}[@]/ /:}" ) + matches=( "${matches[@]##<-> }" ) + + local desc=$ispat'process command line' + _description process-args expl "$desc" + _describe -t process-args "$desc" displ matches "$@" -U "$expl[@]" else _wanted processes-names expl $ispat'process name' _process_names -a -t fi |