1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-12 01:11:27 +02:00

allow `-' in exclusion lists for _arguments, to avoid completing all options (11121)

This commit is contained in:
Sven Wischnowsky 2000-05-03 14:44:01 +00:00
parent 17e79c0157
commit aa0381bd2b
9 changed files with 44 additions and 24 deletions

View file

@ -1,5 +1,11 @@
2000-05-03 Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
* 11121: Completion/User/_fakeroot, Completion/User/_rlogin,
Completion/User/_ssh, Completion/User/_sudo,
Completion/User/_xargs, Completion/X/_xutils, Doc/Zsh/compsys.yo,
Src/Zle/computil.c: allow `-' in exclusion lists for _arguments,
to avoid completing all options
* 11117: Doc/Zsh/expn.yo, Src/hist.c: fix for the (z) flag: report
partial word (like `"foo', without a closing quote); mention in
manual that (z) is handled lately

View file

@ -2,5 +2,6 @@
_arguments \
'--lib[alternate wrapper library]:wrapper library:_files' \
'--faked[alternate faked binary]:fake binary:_command_names' \
'--faked[alternate faked binary]:fake binary: _command_names -e' \
'(-):command name: _command_names -e' \
'*::arguments: _normal'

View file

@ -17,7 +17,7 @@ _rlogin () {
'-n[ignore stdin]' \
'-l[specify login user name]:login as:_rlogin_users' \
':remote host name:_rlogin_hosts' \
':command: _command_names -e' \
'(-):command: _command_names -e' \
'*::command:->command' && ret=0
if [[ -n "$state" ]]; then

View file

@ -18,7 +18,7 @@ _ssh () {
ssh|slogin)
args=(
':remote host name:->userhost'
':command: _command_names -e'
'(-):command: _command_names -e'
'*::args:->command'
)
;&

View file

@ -1,15 +1,19 @@
#compdef sudo
_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]' \
'*::command and arguments:_normal'
'-V[show version]' \
'-l[list allowed commands]' \
'-L[list options from Default section]' \
'-h[show help]' \
'-v[validate user timestamp]' \
'-k[invalidate user timestamp]' \
'-K[remove user timestamp]' \
'-b[run command in background]' \
'-r[Kerberos realm]:Kerberos realm:' \
'-p[password prompt]:password prompt:' \
'-u[user name]:user name:_users' \
'-s[run SHELL]' \
'-H[set HOME environment variable]' \
'-S[read password from stdin]' \
'(-):command name: _command_names -e' \
'*::arguments: _normal'

View file

@ -3,9 +3,11 @@
_arguments \
-{p,t,x} \
-{e-,E}':end-of-file string:' \
-{i-,I}':replacement string for lines:' \
-{l-,L}':number of input lines:' \
'-n:maximum number of arguments:' \
'(-x -I)-i-:replacement string for lines:' \
'(-x -i)-I:replacement string for lines:' \
'(-n -L -x)-l-:number of input lines:' \
'(-n -l)-L:number of input lines:' \
'(-l -L)-n:maximum number of arguments:' \
'-s:maximum command line length:' \
':command: _command_names -e' \
'*::args:_normal'
'(-):command: _command_names -e' \
'*::args: _normal'

View file

@ -107,7 +107,8 @@ xon)
'-screen:screen number:' \
'-user:remote user name:_users' \
':remote host:_hosts' \
'*:command::command:_normal'
'(-):command: _command_names -e' \
'*:command: _normal'
;;
xsetroot)
_x_arguments \

View file

@ -2925,9 +2925,10 @@ argument will not be offered as possible completions if the option
the argument described by the specification will not be offered if the
option tt(-foo) is on the line. Also, the list may contain a single
star as one of its elements to specify that the description for the
rest arguments should not be used and it may contain a colon to
rest arguments should not be used, a colon to
specify that the descriptions for all normal (non-option-) arguments
should not be used.
should not be used and a hyphen to specify that the descriptions for
all options should not be used.
In each of the cases above, the var(action) says how the possible
completions should be generated. In cases where only one of a fixed

View file

@ -1040,7 +1040,12 @@ ca_inactive(Cadef d, char **xor, int cur)
}
if (x[0] == ':' && !x[1])
d->argsactive = 0;
else if (x[0] == '*' && !x[1]) {
else if (x[0] == '-' && !x[1]) {
Caopt p;
for (p = d->opts; p; p = p->next)
p->active = 0;
} else if (x[0] == '*' && !x[1]) {
if (d->rest)
d->rest->active = 0;
} else if (x[0] >= '0' && x[0] <= '9') {