zsh-workers
 help / color / mirror / code / Atom feed
* Re: Passing state information from one completion function to another?
@ 2000-08-15  8:31 Sven Wischnowsky
  2000-08-15  8:42 ` Andrej Borsenkow
  0 siblings, 1 reply; 5+ messages in thread
From: Sven Wischnowsky @ 2000-08-15  8:31 UTC (permalink / raw)
  To: zsh-workers


Andrej Borsenkow wrote:

> What I'd like to have is to list only my own processes in "normal" case and
> everything in case of root. This works with a single exception of sudo (and
> may be su) - in this case completion happens in current user context and does
> not know if it was root or not.
> 
> Is it possible for _sudo to set some state info (notably, that we are after
> sudo at all and user name) that can be queried by other functions? Of course,
> that shoould be cleaned up after completion exits. This may be useful in other
> cases as well - some generic test "if command is to be executed as root/other
> user"

Shouldn't it be enough to use `zstyle -e' and test if $words contains
`sudo' (probably as the first word)?

Bye
 Sven


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


^ permalink raw reply	[flat|nested] 5+ messages in thread
* RE: Passing state information from one completion function to another?
@ 2000-08-15  9:13 Sven Wischnowsky
  0 siblings, 0 replies; 5+ messages in thread
From: Sven Wischnowsky @ 2000-08-15  9:13 UTC (permalink / raw)
  To: zsh-workers


Andrej Borsenkow wrote:

> > Shouldn't it be enough to use `zstyle -e' and test if $words contains
> > `sudo' (probably as the first word)?
> 
> 
> Ehh but if I understand it correctly, in case of
> 
> sudo kill TAB
> 
> $words is modified to be just (kill), removing sudo and any of it's option? In
> more general case
> 
> sudo -u foo kill TAB
> 
> it would be nice to know that we are su'ing to user foo and not to root.
> 
> The problem is, I need this information not when completing sudo but when
> completing command after sudo.

Ouch. Right. Would testing $BUFFER be enough?

Bye
 Sven


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


^ permalink raw reply	[flat|nested] 5+ messages in thread
* Passing state information from one completion function to another?
@ 2000-08-15  7:31 Andrej Borsenkow
  2000-08-15 15:44 ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Andrej Borsenkow @ 2000-08-15  7:31 UTC (permalink / raw)
  To: ZSH workers mailing list

What I'd like to have is to list only my own processes in "normal" case and
everything in case of root. This works with a single exception of sudo (and
may be su) - in this case completion happens in current user context and does
not know if it was root or not.

Is it possible for _sudo to set some state info (notably, that we are after
sudo at all and user name) that can be queried by other functions? Of course,
that shoould be cleaned up after completion exits. This may be useful in other
cases as well - some generic test "if command is to be executed as root/other
user"

-andrej

Have a nice DOS!
B >>


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

end of thread, other threads:[~2000-08-15 15:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-08-15  8:31 Passing state information from one completion function to another? Sven Wischnowsky
2000-08-15  8:42 ` Andrej Borsenkow
  -- strict thread matches above, loose matches on Subject: below --
2000-08-15  9:13 Sven Wischnowsky
2000-08-15  7:31 Andrej Borsenkow
2000-08-15 15:44 ` Bart Schaefer

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