* Completion: How to emulate what this zstyle does natuarlly in a completion function?
@ 2018-05-26 7:05 Doron Behar
2018-05-27 3:45 ` Bart Schaefer
0 siblings, 1 reply; 3+ messages in thread
From: Doron Behar @ 2018-05-26 7:05 UTC (permalink / raw)
To: zsh-workers
Since I first installed zsh, probably when I ran `zsh-newuser-install`,
I had the following line in my `~/.zshrc`:
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
I know that if I remove this line, the `kill` command's completion is
pretty poor and it completes processes from the current tty only. With
this statement in my `~/.zshrc`, `kill` is completed with all processes
of the current user.
My question is: How do I emulate a completion like that naturally within
a completion function? I want a certain command's option argument
completion to suggest all processes the current user just like when I
try to complete `kill`.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Completion: How to emulate what this zstyle does natuarlly in a completion function?
2018-05-26 7:05 Completion: How to emulate what this zstyle does natuarlly in a completion function? Doron Behar
@ 2018-05-27 3:45 ` Bart Schaefer
2018-05-27 8:53 ` Doron Behar
0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2018-05-27 3:45 UTC (permalink / raw)
To: zsh-workers
On Sat, May 26, 2018 at 12:05 AM, Doron Behar <doron.behar@gmail.com> wrote:
>
> My question is: How do I emulate a completion like that naturally within
> a completion function? I want a certain command's option argument
> completion to suggest all processes the current user just like when I
> try to complete `kill`.
You want to call the _pids helper function from that command's
completion function. _pids will use the current context to look up
the command to use to generate the list of possible process IDs.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Completion: How to emulate what this zstyle does natuarlly in a completion function?
2018-05-27 3:45 ` Bart Schaefer
@ 2018-05-27 8:53 ` Doron Behar
0 siblings, 0 replies; 3+ messages in thread
From: Doron Behar @ 2018-05-27 8:53 UTC (permalink / raw)
To: Bart Schaefer; +Cc: zsh-workers
Thanks for your reply Bart,
I tried using `_pids` but it completes pids of processes only in the
current tty. How to I make complete all the processes the user has?
On Sat, May 26, 2018 at 08:45:10PM -0700, Bart Schaefer wrote:
> On Sat, May 26, 2018 at 12:05 AM, Doron Behar <doron.behar@gmail.com> wrote:
> >
> > My question is: How do I emulate a completion like that naturally within
> > a completion function? I want a certain command's option argument
> > completion to suggest all processes the current user just like when I
> > try to complete `kill`.
>
> You want to call the _pids helper function from that command's
> completion function. _pids will use the current context to look up
> the command to use to generate the list of possible process IDs.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-05-27 8:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-26 7:05 Completion: How to emulate what this zstyle does natuarlly in a completion function? Doron Behar
2018-05-27 3:45 ` Bart Schaefer
2018-05-27 8:53 ` Doron Behar
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).