zsh-workers
 help / color / mirror / code / Atom feed
* Problem with _arguments and invalid options
@ 1999-09-10 13:23 Andrej Borsenkow
  1999-09-10 16:19 ` Problem with _arguments and _normal as action if nolistambiguous is set Andrej Borsenkow
  0 siblings, 1 reply; 2+ messages in thread
From: Andrej Borsenkow @ 1999-09-10 13:23 UTC (permalink / raw)
  To: ZSH workers mailing list

Currently, invalid (not listed in description) options are not handled very
nicely. Here is half-hearted example of sudo completion:

_arguments \
	'-V[show version]' \
	'-l[list commands]' \
	'-h[show help]' \
	'-v[validate timestamp file]' \
	'-k[remove timestamp file]' \
	'-b[run command in background]' \
	'-r:Kerberos realm:' \
	'-p:prompt:' \
	'-u:user name:_users' \
	'-s[run SHELL]' \
	'-H[set HOME environment variable]' \
	'*::complete command and/or arguments:_normal'

And now

bor@itsrm2:~/.zsh.d/completion%> sudo -z TAB
bor@itsrm2:~/.zsh.d/completion%> sudo -z _normal: bad option: -z [33]
_
--- file
_sudo     _umount

What's worse - if a command does not list `-s', but you *do* give `-s' - it
seems to be propagated downward and interpreted by _arguments itself (or some
other function, dunno). Just remove definition for -s from above and try:

bor@itsrm2:~/.zsh.d/completion%> sudo -u nTAB
bor@itsrm2:~/.zsh.d/completion%> sudo -u n
--- user
nerv     nobody   nuucp

but

bor@itsrm2:~/.zsh.d/completion%> sudo -s -u nTAB
B-e-e-p

and

bor@itsrm2:~/.zsh.d/completion%> sudo -s -u TAB
bor@itsrm2:~/.zsh.d/completion%> sudo -s -u _
--- file
_sudo     _umount


/andrej


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

* Problem with _arguments and _normal as action if nolistambiguous is set.
  1999-09-10 13:23 Problem with _arguments and invalid options Andrej Borsenkow
@ 1999-09-10 16:19 ` Andrej Borsenkow
  0 siblings, 0 replies; 2+ messages in thread
From: Andrej Borsenkow @ 1999-09-10 16:19 UTC (permalink / raw)
  To: ZSH workers mailing list

With the sudo completion as below, I get very funny results. It does not happen
if I use _files as action instead of _normal. The arguments itself are completed
correctly (that is, command name and parameters), but sudo -TAB is at least
strange.

Again, it is 3.1.6-pws-3 with patches up to 7750

bor@itsrm2:~/.zsh.d/completion%> zsh -f
itsrm2% autoload compinit
itsrm2% fpath=($fpath ~/.zsh.d/completion)
itsrm2% compinit -D
itsrm2% setopt nolistambiguous
itsrm2% compconf describe_options=yes
itsrm2% sudo -TAB
itsrm2% sudo <=cursor here
-
-H -- set HOME environment variable
-V -- show version
-b -- run command in background
-h -- show help
-k -- remove timestamp file
-l -- list commands
-s -- run SHELL
-v -- validate timestamp file
-p  -r  -u

TAB once more

itsrm2% sudo !<=cursor
-
-H -- set HOME environment variable
-V -- show version
-b -- run command in background
-h -- show help
-k -- remove timestamp file
-l -- list commands
-s -- run SHELL
-v -- validate timestamp file
-p  -r  -u

TAB once more

itsrm2% sudo !!<=cursor
-
-H -- set HOME environment variable
-V -- show version
-b -- run command in background
-h -- show help
-k -- remove timestamp file
-l -- list commands
-s -- run SHELL
-v -- validate timestamp file
-p  -r  -u


Here is half-hearted example of sudo completion:
>
> _arguments \
> 	'-V[show version]' \
> 	'-l[list commands]' \
> 	'-h[show help]' \
> 	'-v[validate timestamp file]' \
> 	'-k[remove timestamp file]' \
> 	'-b[run command in background]' \
> 	'-r:Kerberos realm:' \
> 	'-p:prompt:' \
> 	'-u:user name:_users' \
> 	'-s[run SHELL]' \
> 	'-H[set HOME environment variable]' \
> 	'*::complete command and/or arguments:_normal'
>


/andrej


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

end of thread, other threads:[~1999-09-10 16:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-10 13:23 Problem with _arguments and invalid options Andrej Borsenkow
1999-09-10 16:19 ` Problem with _arguments and _normal as action if nolistambiguous is set Andrej Borsenkow

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