zsh-users
 help / color / mirror / code / Atom feed
* ps http<tab> completion to get procees ID
@ 2015-07-28 12:34 zzapper
  2015-07-28 19:19 ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: zzapper @ 2015-07-28 12:34 UTC (permalink / raw)
  To: zsh-users

Hi
This works on my Cygwin zsh 5.0.8
but not on my Centos zsh 5.0.7

what needs to be configured to get this marvellous feature to work?

ps mintty<tab>
   5836   1   5836   5836   ?   1049708   Jul   22   /usr/bin/mintty

   7328   1   7328   7328   ?   1049708   Jul   22   /usr/bin/mintty

   7876   1   7876   7876   ?   1049708   Jul   22   /usr/bin/mintty

   8048   1   8048   8048   ?   1049708   Jul   22   /usr/bin/mintty

   8124   1   8124   8124   ?   1049708   Jul   27   /usr/bin/mintty

   9128   1   9128   9128   ?   1049708   Jul   22   /usr/bin/mintty

-- 
zzapper
https://twitter.com/dailyzshtip

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ps http<tab> completion to get procees ID
  2015-07-28 12:34 ps http<tab> completion to get procees ID zzapper
@ 2015-07-28 19:19 ` Bart Schaefer
  2015-07-30 15:42   ` Daniel Shahaf
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2015-07-28 19:19 UTC (permalink / raw)
  To: zsh-users

On Jul 28, 12:34pm, zzapper wrote:
}
} This works on my Cygwin zsh 5.0.8
} but not on my Centos zsh 5.0.7
} 
} what needs to be configured to get this marvellous feature to work?

Install 5.0.8 on your CentOS?

There were a lot of changes to _main_complete as well as to _ps between
the .7 and .8 releases.  Debug trace is radically different for the two.

It *seems* to work to just copy the 5.0.8 _ps file into fpath somewhere
ahead of the 5.0.7 version, but I can't promise something obscure won't
go wrong.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ps http<tab> completion to get procees ID
  2015-07-28 19:19 ` Bart Schaefer
@ 2015-07-30 15:42   ` Daniel Shahaf
  2015-07-30 16:16     ` Oliver Kiddle
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Shahaf @ 2015-07-30 15:42 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

Bart Schaefer wrote on Tue, Jul 28, 2015 at 12:19:25 -0700:
> On Jul 28, 12:34pm, zzapper wrote:
> }
> } This works on my Cygwin zsh 5.0.8
> } but not on my Centos zsh 5.0.7
> } 
> } what needs to be configured to get this marvellous feature to work?
> 
> Install 5.0.8 on your CentOS?
> 
> There were a lot of changes to _main_complete as well as to _ps between
> the .7 and .8 releases.  Debug trace is radically different for the two.
> 
> It *seems* to work to just copy the 5.0.8 _ps file into fpath somewhere
> ahead of the 5.0.7 version, but I can't promise something obscure won't
> go wrong.

It seems to only complete processes from the current terminal.  For
example, if I just do 'ps <TAB>', I get:

    % ps
    ...
    > process ID
    23620 pts/11   00:00:00 zsh
    23647 pts/11   00:00:00 zsh
    23648 pts/11   00:00:00 ps
    > all matches
    ...

I guess that's due to _pids running 'ps' without further arguments.
Shouldn't the command be configurable?  I'd love to have it show all
user processes (or even all processes when sudoed).

For 'kill' we already allow customizing the listing format via the
'command' style; I suppose it would be nice to support the same here.

Cheers,

Daniel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ps http<tab> completion to get procees ID
  2015-07-30 15:42   ` Daniel Shahaf
@ 2015-07-30 16:16     ` Oliver Kiddle
  2015-07-31 22:52       ` Daniel Shahaf
  0 siblings, 1 reply; 5+ messages in thread
From: Oliver Kiddle @ 2015-07-30 16:16 UTC (permalink / raw)
  To: zsh-users

Daniel Shahaf wrote:
> It seems to only complete processes from the current terminal.  For
> example, if I just do 'ps <TAB>', I get:

> I guess that's due to _pids running 'ps' without further arguments.
> Shouldn't the command be configurable?  I'd love to have it show all
> user processes (or even all processes when sudoed).

It is configurable. The command style is not specific to kill.

I'd recommend using tag labels and use the _next_tags widget if you want
it to pick-up a wider range of processes. Something like the following:

zstyle ':completion:*:(kill|lsof|ps|ss):*:' tag-order processes:-tty 'processes:-mine:user\ processes' 'processes:-all:all\ processes'
zstyle ':completion:*:([sl]trace|truss|gcore|gdb):*:' tag-order processes:-mine 'processes:-all:all\ processes'
case $OSTYPE in
  *bsd*)
    zstyle ':completion:*:processes' command 'ps -o pid,ppid,state,start,args'
    zstyle ':completion:*:processes-mine' command "ps U $EUID -o pid,ppid,state,start,args"
    zstyle ':completion:*:processes-all' command "ps A -o pid,ppid,state,start,args"
  ;;
  *)
    zstyle ':completion:*:processes' command 'ps -o pid,s,ppid,stime,args'
    zstyle ':completion:*:processes-mine' command "ps -u $EUID -o pid,s,ppid,stime,args"
    zstyle ':completion:*:processes-all' command 'ps -e -o pid,s,ppid,stime,args'
  ;;
esac

Oliver


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: ps http<tab> completion to get procees ID
  2015-07-30 16:16     ` Oliver Kiddle
@ 2015-07-31 22:52       ` Daniel Shahaf
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Shahaf @ 2015-07-31 22:52 UTC (permalink / raw)
  To: zsh-users

Oliver Kiddle wrote on Thu, Jul 30, 2015 at 18:16:57 +0200:
> Daniel Shahaf wrote:
> > It seems to only complete processes from the current terminal.  For
> > example, if I just do 'ps <TAB>', I get:
> 
> > I guess that's due to _pids running 'ps' without further arguments.
> > Shouldn't the command be configurable?  I'd love to have it show all
> > user processes (or even all processes when sudoed).
> 
> It is configurable. The command style is not specific to kill.
> 
> I'd recommend using tag labels and use the _next_tags widget if you want
> it to pick-up a wider range of processes. Something like the following:
> 
> zstyle ':completion:*:(kill|lsof|ps|ss):*:' tag-order processes:-tty 'processes:-mine:user\ processes' 'processes:-all:all\ processes'
> zstyle ':completion:*:([sl]trace|truss|gcore|gdb):*:' tag-order processes:-mine 'processes:-all:all\ processes'
> case $OSTYPE in
>   *bsd*)
>     zstyle ':completion:*:processes' command 'ps -o pid,ppid,state,start,args'
>     zstyle ':completion:*:processes-mine' command "ps U $EUID -o pid,ppid,state,start,args"
>     zstyle ':completion:*:processes-all' command "ps A -o pid,ppid,state,start,args"
>   ;;
>   *)
>     zstyle ':completion:*:processes' command 'ps -o pid,s,ppid,stime,args'
>     zstyle ':completion:*:processes-mine' command "ps -u $EUID -o pid,s,ppid,stime,args"
>     zstyle ':completion:*:processes-all' command 'ps -e -o pid,s,ppid,stime,args'
>   ;;
> esac

Thank you!


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-07-31 22:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-28 12:34 ps http<tab> completion to get procees ID zzapper
2015-07-28 19:19 ` Bart Schaefer
2015-07-30 15:42   ` Daniel Shahaf
2015-07-30 16:16     ` Oliver Kiddle
2015-07-31 22:52       ` Daniel Shahaf

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).