From 573895dd60974354cdabd0632bd0367d04e7ddbc Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Fri, 30 Sep 2016 09:57:33 +0200 Subject: 39513: new doas completion --- Completion/Unix/Command/_doas | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Completion/Unix/Command/_doas (limited to 'Completion/Unix/Command/_doas') diff --git a/Completion/Unix/Command/_doas b/Completion/Unix/Command/_doas new file mode 100644 index 000000000..5c26b1d25 --- /dev/null +++ b/Completion/Unix/Command/_doas @@ -0,0 +1,18 @@ +#compdef doas + +local environ e cmd + +zstyle -a ":completion:${curcontext}:" environ environ + +for e in "${environ[@]}" +do local -x "$e" +done + +cmd="$words[1]" +_arguments -s -S \ + '(-n -s)-C+[check config file and report on command matching]:config:_files' \ + '(-C)-n[non-interactive: fail rather than prompt for a password]' \ + '-a+[specify authentication style]:authentication style' \ + '(-C)-s[run a shell]' \ + '-u+[run command as specified user]:user:_users' \ + '*::arguments:{ _comp_priv_prefix=( $cmd -n ${(kv)opt_args[-u]} ) ; _normal }' -- cgit v1.2.3 From c40226022a4fa8990c83ac1f3300c84295da353b Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Sat, 1 Oct 2016 09:34:30 -0500 Subject: 39533: add the new -L option, sort options and add some exclusions --- ChangeLog | 5 +++++ Completion/Unix/Command/_doas | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'Completion/Unix/Command/_doas') diff --git a/ChangeLog b/ChangeLog index 4ce4ec2e3..1afd5e654 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-10-13 Oliver Kiddle + + * 39533: Matthew Martin: Completion/Unix/Command/_doas: + add the new -L option, sort options and add some exclusions + 2016-10-11 Peter Stephenson * 36108: Src/builtin.c: command -[vV] assumed -p. diff --git a/Completion/Unix/Command/_doas b/Completion/Unix/Command/_doas index 5c26b1d25..b36388ead 100644 --- a/Completion/Unix/Command/_doas +++ b/Completion/Unix/Command/_doas @@ -9,10 +9,13 @@ do local -x "$e" done cmd="$words[1]" -_arguments -s -S \ +_arguments -s -S -A '-*' : \ + - optL \ + '-L[clear any persisted authorizations]' \ + - default \ + '-a+[specify authentication style]:authentication style' \ '(-n -s)-C+[check config file and report on command matching]:config:_files' \ '(-C)-n[non-interactive: fail rather than prompt for a password]' \ - '-a+[specify authentication style]:authentication style' \ - '(-C)-s[run a shell]' \ + '(-C *)-s[run a shell]' \ '-u+[run command as specified user]:user:_users' \ '*::arguments:{ _comp_priv_prefix=( $cmd -n ${(kv)opt_args[-u]} ) ; _normal }' -- cgit v1.2.3 From 1955cceec79107b6571646b695d334df8e4a6cd8 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 24 Nov 2016 07:02:11 +0000 Subject: 40011: Make $_comp_priv_prefix only declared when required, and use that to have chgrp offer all groups under doas, ssh, etc as well. --- ChangeLog | 8 ++++++++ Completion/Base/Core/_main_complete | 4 +++- Completion/Solaris/Command/_pfexec | 1 + Completion/Solaris/Command/_zlogin | 3 +-- Completion/Unix/Command/_chown | 4 ++-- Completion/Unix/Command/_doas | 1 + Completion/Unix/Command/_sudo | 1 + 7 files changed, 17 insertions(+), 5 deletions(-) (limited to 'Completion/Unix/Command/_doas') diff --git a/ChangeLog b/ChangeLog index 53dcc07de..1c0d3673c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2016-11-28 Daniel Shahaf + * 40011: Completion/Base/Core/_main_complete, + Completion/Solaris/Command/_pfexec, + Completion/Solaris/Command/_zlogin, + Completion/Unix/Command/_chown, Completion/Unix/Command/_doas, + Completion/Unix/Command/_sudo: Make $_comp_priv_prefix only + declared when required, and use that to have chgrp offer all + groups under doas, ssh, etc as well. + * 40010: Src/builtin.c, Test/A02alias.ztst: builtins: Say 'bad option: +x', not 'bad option: -x', when +x was passed. diff --git a/Completion/Base/Core/_main_complete b/Completion/Base/Core/_main_complete index c292ce7d7..aa2486236 100644 --- a/Completion/Base/Core/_main_complete +++ b/Completion/Base/Core/_main_complete @@ -38,7 +38,9 @@ local func funcs ret=1 tmp _compskip format nm call match min max i num\ _saved_colors="$ZLS_COLORS" \ _saved_colors_set=${+ZLS_COLORS} \ _ambiguous_color='' -local -a _comp_priv_prefix +# Hide any '_comp_priv_prefix' variable that happens to be defined in the calling scope. +local _comp_priv_prefix +unset _comp_priv_prefix # _precommand sets this to indicate we are following a precommand modifier local -a precommands diff --git a/Completion/Solaris/Command/_pfexec b/Completion/Solaris/Command/_pfexec index 2afaf317b..2519c3cdc 100644 --- a/Completion/Solaris/Command/_pfexec +++ b/Completion/Solaris/Command/_pfexec @@ -22,6 +22,7 @@ _privset() { } _pfexec() { + local -a _comp_priv_prefix _arguments \ '-P[privileges to acquire]:privspec:_privset' \ '(-):command name: _command_names -e' \ diff --git a/Completion/Solaris/Command/_zlogin b/Completion/Solaris/Command/_zlogin index 065f55b03..74cbafe82 100644 --- a/Completion/Solaris/Command/_zlogin +++ b/Completion/Solaris/Command/_zlogin @@ -1,9 +1,8 @@ #compdef zlogin # Synced with the Nevada build 162 man page -local -a _comp_priv_prefix - _zlogin() { + local -a _comp_priv_prefix _arguments -s \ '-E[Disable escape character]' \ '-e[Specify escape character]:character:' \ diff --git a/Completion/Unix/Command/_chown b/Completion/Unix/Command/_chown index 641b5a773..5750c65ab 100644 --- a/Completion/Unix/Command/_chown +++ b/Completion/Unix/Command/_chown @@ -45,8 +45,8 @@ _arguments -C -s "$args[@]" '*:files:->files' && ret=0 case $state in owner) if [[ $service = chgrp ]] || compset -P '*[:.]'; then - if (( EGID && $+commands[groups] && ! $+funcstack[(r)_sudo] )); then # except for root - _wanted groups expl 'group' compadd $(groups) && return 0 + if (( EGID && $+commands[groups] && ! $+_comp_priv_prefix )); then # except for sudo + _wanted groups expl 'group' compadd -- $(groups) && return 0 fi _groups && ret=0 else diff --git a/Completion/Unix/Command/_doas b/Completion/Unix/Command/_doas index b36388ead..94395557c 100644 --- a/Completion/Unix/Command/_doas +++ b/Completion/Unix/Command/_doas @@ -1,6 +1,7 @@ #compdef doas local environ e cmd +local -a _comp_priv_prefix zstyle -a ":completion:${curcontext}:" environ environ diff --git a/Completion/Unix/Command/_sudo b/Completion/Unix/Command/_sudo index 0a212b723..aa7a1a498 100644 --- a/Completion/Unix/Command/_sudo +++ b/Completion/Unix/Command/_sudo @@ -4,6 +4,7 @@ setopt localoptions extended_glob local environ e cmd local -a args +local -a _comp_priv_prefix zstyle -a ":completion:${curcontext}:" environ environ -- cgit v1.2.3