mirror of
git://git.code.sf.net/p/zsh/code
synced 2026-01-03 20:51:07 +01:00
39333: include name of command used to gain priviliges in context for command and gain-priviliges styles
This commit is contained in:
parent
fbafc5b509
commit
b870ff85a0
5 changed files with 18 additions and 7 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
setopt localoptions extended_glob
|
||||
|
||||
local environ e
|
||||
local environ e cmd
|
||||
local -a args
|
||||
|
||||
zstyle -a ":completion:${curcontext}:" environ environ
|
||||
|
|
@ -39,6 +39,7 @@ args=(
|
|||
if [[ $service = sudoedit ]] || (( $words[(i)-e] < $words[(i)^(*sudo|-[^-]*)] )) ; then
|
||||
args=( -A "-*" $args '!(-V --version -h --help)-e' '*:file:_files' )
|
||||
else
|
||||
cmd="$words[1]"
|
||||
args+=(
|
||||
'(-e --edit 1 *)'{-e,--edit}'[edit files instead of running a command]' \
|
||||
'(-s --shell)'{-s,--shell}'[run shell as the target user; a command may also be specified]' \
|
||||
|
|
@ -48,7 +49,7 @@ else
|
|||
'(-H --set-home -i --login -s --shell -e --edit)'{-H,--set-home}"[set HOME variable to target user's home dir]" \
|
||||
'(-P --preserve-groups -i -login -s --shell -e --edit)'{-P,--preserve-groups}"[preserve group vector instead of setting to target's]" \
|
||||
'(-)1:command: _command_names -e'
|
||||
'*::arguments:{ _comp_priv_prefix=( $words[1] -n ${(kv)opt_args[(I)(-[ugHEP]|--(user|group|set-home|preserve-env|preserve-groups))]} ) ; _normal }'
|
||||
'*::arguments:{ _comp_priv_prefix=( $cmd -n ${(kv)opt_args[(I)(-[ugHEP]|--(user|group|set-home|preserve-env|preserve-groups))]} ) ; _normal }'
|
||||
)
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue