zsh-workers
 help / color / mirror / code / Atom feed
* _killall on linux
@ 2000-07-08 14:49 Thomas Köhler
  2000-07-08 17:02 ` Bart Schaefer
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Köhler @ 2000-07-08 14:49 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 951 bytes --]

Hi,
I'm using zsh-3.1.9 and the new completion system.
Now, the problem is: _killall won't complete all process names. This is
not a big deal for "normal" users, but root may have to kill other
user's processes, too. May I suggest something like this (completing
_all_ process names for super users)


------- _killall -------
#compdef killall

if [[ "$OSTYPE" = linux* ]]; then
  _alternative \
      'signals:: _signals -p' \
      'processes:process:{ compadd "$expl[@]" ${$(_call processes-names ps $( [[ "$UID" = 0 ]] && print -n xa ) ho comm 2> /dev/null):#(ps|COMMAND)} }'
else
  _signals -p
fi 
------- _killall -------

CU,
Thomas

-- 
 Thomas Köhler Email:   jean-luc@picard.franken.de     | LCARS - Linux
     <><        WWW:     http://jeanluc-picard.de      | for Computers
                IRC:             jeanluc               | on All Real
               PGP public key available from Homepage! | Starships

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

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

* Re: _killall on linux
  2000-07-08 14:49 _killall on linux Thomas Köhler
@ 2000-07-08 17:02 ` Bart Schaefer
  2000-07-08 17:25   ` Bart Schaefer
  2000-07-08 18:50   ` Thomas Köhler
  0 siblings, 2 replies; 7+ messages in thread
From: Bart Schaefer @ 2000-07-08 17:02 UTC (permalink / raw)
  To: Thomas Köhler, zsh-workers

On Jul 8,  4:49pm, Thomas Köhler wrote:
} Subject: _killall on linux
}
} Now, the problem is: _killall won't complete all process names. This is
} not a big deal for "normal" users, but root may have to kill other
} user's processes, too. May I suggest something like this (completing
} _all_ process names for super users)

We could put something like that [*] in, but you should note that this
can already be configured via a style in root's .zshrc:

    zstyle ':completion:*:processes-names' command ps xa ho comm

Making that configurable is the reason for the $(_call ...) expression.

It's a bit weird that it's "processes-names" rather than "process-names".
(Was there some reason for that?  It's not completing both processes and
names, and one doesn't normally use the possessive "processes' names" to
refer to "names of processes".)

[*] Rather than $( [[ "$UID" = 0 ]] && print -n xa ) I'd suggest the less
resource-intensive ${=EUID//(#s)0(#e)/ps xa}.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   

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

* Re: _killall on linux
  2000-07-08 17:02 ` Bart Schaefer
@ 2000-07-08 17:25   ` Bart Schaefer
  2000-07-08 18:50   ` Thomas Köhler
  1 sibling, 0 replies; 7+ messages in thread
From: Bart Schaefer @ 2000-07-08 17:25 UTC (permalink / raw)
  To: Thomas Köhler, zsh-workers

On Jul 8,  5:02pm, Bart Schaefer wrote:
}
} [*] Rather than $( [[ "$UID" = 0 ]] && print -n xa ) I'd suggest the less
} resource-intensive ${=EUID//(#s)0(#e)/ps xa}.

Of course it helps to complete my thought before I commit it to mail.
What I meant was ${${EUID/(#s)0(#e)/xa}//[0-9]#/}.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

* Re: _killall on linux
  2000-07-08 17:02 ` Bart Schaefer
  2000-07-08 17:25   ` Bart Schaefer
@ 2000-07-08 18:50   ` Thomas Köhler
  1 sibling, 0 replies; 7+ messages in thread
From: Thomas Köhler @ 2000-07-08 18:50 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1870 bytes --]

On Sat, Jul 08, 2000 at 07:02:58PM +0200,
Bart Schaefer <schaefer@candle.brasslantern.com> wrote:
> 
> On Jul 8,  4:49pm, Thomas Köhler wrote:
> } Subject: _killall on linux
> }
> } Now, the problem is: _killall won't complete all process names. This is
> } not a big deal for "normal" users, but root may have to kill other
> } user's processes, too. May I suggest something like this (completing
> } _all_ process names for super users)
> 
> We could put something like that [*] in, but you should note that this
> can already be configured via a style in root's .zshrc:
> 
>     zstyle ':completion:*:processes-names' command ps xa ho comm

Uhm. Cool. :-)

> Making that configurable is the reason for the $(_call ...) expression.

Ah... I seem to get the idea...

> It's a bit weird that it's "processes-names" rather than "process-names".
> (Was there some reason for that?  It's not completing both processes and
> names, and one doesn't normally use the possessive "processes' names" to
> refer to "names of processes".)

Don't know, but it's consistent :)
_pid calls this: "... _call processes-list ..."

> [*] Rather than $( [[ "$UID" = 0 ]] && print -n xa ) I'd suggest the less
> resource-intensive ${=EUID//(#s)0(#e)/ps xa}.

Well, seen your fixed version (other mail) already:
${${EUID/(#s)0(#e)/xa}//[0-9]#/}

Well - could this go in? Would save quite a few linux users some .zshrc
editing :-)

CU,
Thomas

P.S.: No need to Cc me, I'm also subscribed to zsh-workers (I'd call
myself a very passive member of this list ;-))

-- 
 Thomas Köhler Email:   jean-luc@picard.franken.de     | LCARS - Linux
     <><        WWW:     http://jeanluc-picard.de      | for Computers
                IRC:             jeanluc               | on All Real
               PGP public key available from Homepage! | Starships

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

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

* Re: _killall on linux
@ 2000-07-10  9:43 Sven Wischnowsky
  0 siblings, 0 replies; 7+ messages in thread
From: Sven Wischnowsky @ 2000-07-10  9:43 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> ...
>  
> } At least I thought it would be easier...
> 
> It's only easier that way if you know about the rule in advance (and if it
> is applied consistently, which it may very well be, I haven't looked).  Is
> it mentioned as a general principle anywhere in the docs?

Well, the docs mention the processes and processes-list tags for the
command style (as examples).

The processes-names is listed together with processes and
processes-list in the tag list, of course, and processes seems to be
the only case where we needed to call _call more than once for a given 
tag.

> } > [*] Rather than $( [[ "$UID" = 0 ]] && print -n xa ) I'd suggest the less
> } > resource-intensive ${=EUID//(#s)0(#e)/ps xa}.
> } 
> } I wouldn't be agains that patch. But I think it raises the question if 
> } we should add other default for some systems, such as -u$USER.
> 
> As it turns out, the _call to ps is already in a linux-specific section
> of _killall, so the syntax for other variants of ps is irrelevant.

Ah. Sorry. I was looking at _pids.

Well, then...

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


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

* Re: _killall on linux
  2000-07-10  7:13 Sven Wischnowsky
@ 2000-07-10  9:31 ` Bart Schaefer
  0 siblings, 0 replies; 7+ messages in thread
From: Bart Schaefer @ 2000-07-10  9:31 UTC (permalink / raw)
  To: Sven Wischnowsky, zsh-workers

On Jul 10,  9:13am, Sven Wischnowsky wrote:
} Subject: Re: _killall on linux
}
} Bart Schaefer wrote:
} 
} > It's a bit weird that it's "processes-names" rather than "process-names".
} > (Was there some reason for that?
} 
} It doesn't have anything to do with real english -- it's just the tag
} used with some strings appended, to make it easier to remember them.

Aha.
 
} At least I thought it would be easier...

It's only easier that way if you know about the rule in advance (and if it
is applied consistently, which it may very well be, I haven't looked).  Is
it mentioned as a general principle anywhere in the docs?

} > [*] Rather than $( [[ "$UID" = 0 ]] && print -n xa ) I'd suggest the less
} > resource-intensive ${=EUID//(#s)0(#e)/ps xa}.
} 
} I wouldn't be agains that patch. But I think it raises the question if 
} we should add other default for some systems, such as -u$USER.

As it turns out, the _call to ps is already in a linux-specific section
of _killall, so the syntax for other variants of ps is irrelevant.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

* Re: _killall on linux
@ 2000-07-10  7:13 Sven Wischnowsky
  2000-07-10  9:31 ` Bart Schaefer
  0 siblings, 1 reply; 7+ messages in thread
From: Sven Wischnowsky @ 2000-07-10  7:13 UTC (permalink / raw)
  To: zsh-workers

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1439 bytes --]


Bart Schaefer wrote:

> On Jul 8,  4:49pm, Thomas Köhler wrote:
> } Subject: _killall on linux
> }
> } Now, the problem is: _killall won't complete all process names. This is
> } not a big deal for "normal" users, but root may have to kill other
> } user's processes, too. May I suggest something like this (completing
> } _all_ process names for super users)
> 
> We could put something like that [*] in, but you should note that this
> can already be configured via a style in root's .zshrc:
> 
>     zstyle ':completion:*:processes-names' command ps xa ho comm
> 
> Making that configurable is the reason for the $(_call ...) expression.
> 
> It's a bit weird that it's "processes-names" rather than "process-names".
> (Was there some reason for that?  It's not completing both processes and
> names, and one doesn't normally use the possessive "processes' names" to
> refer to "names of processes".)

It doesn't have anything to do with real english -- it's just the tag
used with some strings appended, to make it easier to remember them.

At least I thought it would be easier...

> [*] Rather than $( [[ "$UID" = 0 ]] && print -n xa ) I'd suggest the less
> resource-intensive ${=EUID//(#s)0(#e)/ps xa}.

I wouldn't be agains that patch. But I think it raises the question if 
we should add other default for some systems, such as -u$USER.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


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

end of thread, other threads:[~2000-07-10  9:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-08 14:49 _killall on linux Thomas Köhler
2000-07-08 17:02 ` Bart Schaefer
2000-07-08 17:25   ` Bart Schaefer
2000-07-08 18:50   ` Thomas Köhler
2000-07-10  7:13 Sven Wischnowsky
2000-07-10  9:31 ` Bart Schaefer
2000-07-10  9:43 Sven Wischnowsky

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