From aa0381bd2b64ad6ea1e24110c1c2ec6773f9288e Mon Sep 17 00:00:00 2001 From: Sven Wischnowsky Date: Wed, 3 May 2000 14:44:01 +0000 Subject: allow `-' in exclusion lists for _arguments, to avoid completing all options (11121) --- ChangeLog | 6 ++++++ Completion/User/_fakeroot | 3 ++- Completion/User/_rlogin | 2 +- Completion/User/_ssh | 2 +- Completion/User/_sudo | 28 ++++++++++++++++------------ Completion/User/_xargs | 12 +++++++----- Completion/X/_xutils | 3 ++- Doc/Zsh/compsys.yo | 5 +++-- Src/Zle/computil.c | 7 ++++++- 9 files changed, 44 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9a7757b7a..d0d96c532 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2000-05-03 Sven Wischnowsky + * 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 diff --git a/Completion/User/_fakeroot b/Completion/User/_fakeroot index 64e259d3d..bb9655a85 100644 --- a/Completion/User/_fakeroot +++ b/Completion/User/_fakeroot @@ -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' diff --git a/Completion/User/_rlogin b/Completion/User/_rlogin index 2509bd79c..abc6f116e 100644 --- a/Completion/User/_rlogin +++ b/Completion/User/_rlogin @@ -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 diff --git a/Completion/User/_ssh b/Completion/User/_ssh index 04ee5f2e2..986dec0c0 100644 --- a/Completion/User/_ssh +++ b/Completion/User/_ssh @@ -18,7 +18,7 @@ _ssh () { ssh|slogin) args=( ':remote host name:->userhost' - ':command: _command_names -e' + '(-):command: _command_names -e' '*::args:->command' ) ;& diff --git a/Completion/User/_sudo b/Completion/User/_sudo index cfa8172fb..2b5a5cb7d 100644 --- a/Completion/User/_sudo +++ b/Completion/User/_sudo @@ -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' diff --git a/Completion/User/_xargs b/Completion/User/_xargs index 71aff222f..8b9291227 100644 --- a/Completion/User/_xargs +++ b/Completion/User/_xargs @@ -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' diff --git a/Completion/X/_xutils b/Completion/X/_xutils index c0d94a998..17100c033 100644 --- a/Completion/X/_xutils +++ b/Completion/X/_xutils @@ -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 \ diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index 7df485767..b3402d664 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -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 diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c index 1846bc62f..77887a03e 100644 --- a/Src/Zle/computil.c +++ b/Src/Zle/computil.c @@ -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') { -- cgit 1.4.1