From: Marlon Richert <marlon.richert@gmail.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: [PATCH] Fix pgrep/pkill -f completion
Date: Fri, 21 May 2021 15:59:00 +0300 [thread overview]
Message-ID: <CAHLkEDsJ=EfsTZ0ddJK91sz3p_RqEfT8ENKDcr1GA7yZPx+C+g@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 70 bytes --]
Old completion produced false positives & took too much screen space.
[-- Attachment #2: 0001-Fix-pgrep-pkill-f-completion.txt --]
[-- Type: text/plain, Size: 1334 bytes --]
From 112968b31ea926a40a640921f53b71a7f57c0f52 Mon Sep 17 00:00:00 2001
From: Marlon Richert <marlon.richert@gmail.com>
Date: Fri, 21 May 2021 15:56:42 +0300
Subject: [PATCH] Fix pgrep/pkill -f completion
Old completion produced false positives & took too much screen space.
---
Completion/Unix/Command/_pgrep | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/Completion/Unix/Command/_pgrep b/Completion/Unix/Command/_pgrep
index 51a4883df..22871dd20 100644
--- a/Completion/Unix/Command/_pgrep
+++ b/Completion/Unix/Command/_pgrep
@@ -166,9 +166,16 @@ 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=)"}% *}
- else
+ 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
;;
--
2.31.1
next reply other threads:[~2021-05-21 13:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-21 12:59 Marlon Richert [this message]
2021-05-25 7:42 ` dana
2021-06-07 22:32 ` Lawrence Velázquez
2021-06-07 22:36 ` Lawrence Velázquez
2021-06-09 4:11 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAHLkEDsJ=EfsTZ0ddJK91sz3p_RqEfT8ENKDcr1GA7yZPx+C+g@mail.gmail.com' \
--to=marlon.richert@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).