Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Re: sudo completion problem
- X-seq: zsh-workers 11121
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: PATCH: Re: sudo completion problem
- Date: Wed, 3 May 2000 16:42:06 +0200 (MET DST)
- In-reply-to: "Andrej Borsenkow"'s message of Wed, 3 May 2000 17:06:56 +0400
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Andrej Borsenkow wrote:
> bor@itsrm2% sudo rm -r
> Completing Kerberos realm
> Completing `Kerberos realm'
>
> Hmm ... it treats -r as sudo option ... but, I think, it did work once
> ...
If it did, then only before we used the separate description to get
only external command names or because there was some other bug.
Hm. From the logic of the specifications used by _sudo, this
completion is correct, after all, there may be options between
arguments unless otherwise specified.
So this adds the special string `-' for exclusion lists which makes
the description for the options not be used any more. And it makes
this be used in the places where we have such _command_names/_normal
combinations.
Bye
Sven
Index: Completion/User/_fakeroot
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_fakeroot,v
retrieving revision 1.1
diff -u -r1.1 _fakeroot
--- Completion/User/_fakeroot 2000/04/08 21:06:48 1.1
+++ Completion/User/_fakeroot 2000/05/03 14:39:09
@@ -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'
Index: Completion/User/_rlogin
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_rlogin,v
retrieving revision 1.3
diff -u -r1.3 _rlogin
--- Completion/User/_rlogin 2000/04/11 07:57:57 1.3
+++ Completion/User/_rlogin 2000/05/03 14:39:09
@@ -17,7 +17,7 @@
'-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
Index: Completion/User/_ssh
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_ssh,v
retrieving revision 1.2
diff -u -r1.2 _ssh
--- Completion/User/_ssh 2000/04/05 11:28:09 1.2
+++ Completion/User/_ssh 2000/05/03 14:39:09
@@ -18,7 +18,7 @@
ssh|slogin)
args=(
':remote host name:->userhost'
- ':command: _command_names -e'
+ '(-):command: _command_names -e'
'*::args:->command'
)
;&
Index: Completion/User/_sudo
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_sudo,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 _sudo
--- Completion/User/_sudo 2000/03/09 11:43:52 1.1.1.3
+++ Completion/User/_sudo 2000/05/03 14:39:09
@@ -15,5 +15,5 @@
'-s[run SHELL]' \
'-H[set HOME environment variable]' \
'-S[read password from stdin]' \
- ':complete command name: _command_names -e' \
+ '(-):command name: _command_names -e' \
'*::arguments: _normal'
Index: Completion/User/_xargs
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_xargs,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 _xargs
--- Completion/User/_xargs 1999/09/07 12:55:12 1.1.1.2
+++ Completion/User/_xargs 2000/05/03 14:39:09
@@ -9,5 +9,5 @@
'(-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'
Index: Completion/X/_xutils
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/_xutils,v
retrieving revision 1.4
diff -u -r1.4 _xutils
--- Completion/X/_xutils 2000/04/11 07:57:57 1.4
+++ Completion/X/_xutils 2000/05/03 14:39:09
@@ -107,7 +107,8 @@
'-screen:screen number:' \
'-user:remote user name:_users' \
':remote host:_hosts' \
- '*:command::command:_normal'
+ '(-):command: _command_names -e' \
+ '*:command: _normal'
;;
xsetroot)
_x_arguments \
Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.31
diff -u -r1.31 compsys.yo
--- Doc/Zsh/compsys.yo 2000/05/03 08:46:52 1.31
+++ Doc/Zsh/compsys.yo 2000/05/03 14:39:11
@@ -2925,9 +2925,10 @@
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
Index: Src/Zle/computil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v
retrieving revision 1.11
diff -u -r1.11 computil.c
--- Src/Zle/computil.c 2000/05/02 08:56:28 1.11
+++ Src/Zle/computil.c 2000/05/03 14:39:12
@@ -1040,7 +1040,12 @@
}
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') {
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author