summary refs log tree commit diff
path: root/Completion/Unix/Command/_sudo
blob: 384e9358b0abcb53eb90db496828b0c820131d49 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#compdef sudo sudoedit

local curcontext="$curcontext" environ e
local -a args

zstyle -a "$curcontext" environ environ

for e in "${environ[@]}"
do local -x "$e"
done

args=(
       '-V[show version]'
       '-l[list allowed commands]'
       '-L[list options from Default section]'
       '-a[BSD auth type]:BSD auth type:'
       '-c[BSD login class]:BSD login class:'
       '-h[show help]'
       '-v[validate user timestamp]'
       '-k[invalidate user timestamp]'
       '-K[remove user timestamp]'
       '-r[Kerberos realm]:Kerberos realm:'
       '-p[password prompt]:password prompt:'
       '-u[user name]:user name:_users'
       '-S[read password from stdin]'
)

if [[ $service = sudoedit ]]; then
  _arguments $args \
    '*:file: _files'
else
  _arguments $args \
    '(- :)-e[edit file]:*:file:_files' \
    '(- :)-s[run SHELL]' \
    '(- :)-i[simulate login]' \
    '(-i -s -e)-b[run command in background]' \
    '(-i -s -e)-E[preserve environment]' \
    '(-i -s -e)-H[set HOME environment variable]' \
    '(-i -s -e)-P[preserve group vector]' \
    '(-):command: _command_names -e' \
    '*::arguments: _normal'
fi