1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-29 05:21:00 +01:00
zsh/Completion/BSD/Command/_jexec
Oliver Kiddle 8011fe8a58 39261 (tweaked cf. Daniel: 39275): don't unconditionally elevate privileges with sudo in completion functions
A new gain-privileges style enables it and a _comp_priv_prefix array
added for tracking how to match privileges for the current command
2016-09-11 13:49:22 +02:00

21 lines
532 B
Text

#compdef jexec
_jexec_normal() {
local PATH=$PATH
local -a _comp_priv_prefix
# relative paths are relative to the jail's root
path=( "$(command jls -j $words[1] path)"/$^path )
shift 1 words; (( CURRENT-- ))
_normal
}
_jexec() {
_arguments -s -S -A "-*" : \
'-l[execute in a clean environment]' \
'(-U)-u[host environment user whom command runs as]:host user:_users' \
'(-u)-U[jail environment user whom command runs as]:jail user:_users' \
'1:jail:_jails' \
'*:: : _jexec_normal'
}
_jexec "$@"