blob: df1b89f97b49c7679ae99d9c9e2bed436957dc71 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#compdef su
local shell comp name usr base
[[ $words[2] != - ]]
(( base=$?+2 ))
if [[ CURRENT -eq base ]]; then
_users && return
usr=root
elif [[ CURRENT -ge base+1 ]]; then
usr=$words[base]
else
return
fi
shell="${${(M@)${(@f)$(</etc/passwd)}:#root*}##*:}"
compset -n $base
for name in $shell $shell:t -default-; do
comp="$_comps[$name]"
[[ -n "$comp" ]] && "$comp" && return
done
|