1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-27 04:40:59 +01:00

48891: Fix pgrep/pkill -f completion

Old completion produced false positives & took too much screen space.
This commit is contained in:
Marlon Richert 2021-05-21 15:56:42 +03:00 committed by Oliver Kiddle
parent e732073415
commit 891d361572
2 changed files with 12 additions and 2 deletions

View file

@ -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