about summary refs log tree commit diff
diff options
context:
space:
mode:
authordana <dana@dana.is>2021-06-14 22:19:38 -0500
committerdana <dana@dana.is>2021-06-14 22:19:38 -0500
commitc6603669a2667a4905aa4831f40e276b2c3bd4a4 (patch)
tree3f24a770460767fa73333c433a6084fbdae54d64
parent32450b7c816159d540fe872bf7340928300aa360 (diff)
downloadzsh-c6603669a2667a4905aa4831f40e276b2c3bd4a4.tar.gz
zsh-c6603669a2667a4905aa4831f40e276b2c3bd4a4.tar.xz
zsh-c6603669a2667a4905aa4831f40e276b2c3bd4a4.zip
48920: _pgrep: Address issues related to -f completion
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Unix/Command/_pgrep7
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 1f559c22e..648f030e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2021-06-14  dana  <dana@dana.is>
 
+	* 48920: Completion/Unix/Command/_pgrep: Address issues related to
+	-f completion
+
 	* 48920: Completion/Unix/Command/_pgrep: Clarify -x description
 
 2021-06-13  Bart Schaefer  <schaefer@zsh.org>
diff --git a/Completion/Unix/Command/_pgrep b/Completion/Unix/Command/_pgrep
index 443acf3c8..38b1aebd8 100644
--- a/Completion/Unix/Command/_pgrep
+++ b/Completion/Unix/Command/_pgrep
@@ -170,10 +170,13 @@ case $state in
       ispat+="full "
     fi
     if (( ${+opt_args[-f]} )); then
+      local -a opts=( -lf )
+      [[ $OSTYPE == linux* ]] && opts=( -a )
       local -a matches=( ${(f)"$(
-              _call_program process-args pgrep -lf ${${:-$PREFIX$SUFFIX}:-.\*}
+              _call_program process-args pgrep ${(@q)opts} -- \
+                  ${(q)${${:-$PREFIX$SUFFIX}:-.\*}}
           )"} )
-      local -a displ=( "${${matches[@]//':'/'\:'}[@]/ /:}" )
+      local -a displ=( "${${matches[@]//:/\:}[@]/ /:}" )
       matches=( "${matches[@]##<-> }" )
 
       local desc=$ispat'process command line'