about summary refs log tree commit diff
path: root/Completion/Darwin/Command/_scutil
blob: 6c0a84d642806026f369c7b822507ef8ab06bb1d (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#compdef scutil

local ret=1
local -a context line state state_descr
local -A opt_args val_args

# Don't complete host names unless we have -r (this is weird, but the obvious
# alternative (exclusion sets) currently doesn't work properly with option
# stacking)
(( ! $words[(I)-*] || ($words[(I)-W] && ! $words[(I)-r]) )) &&
: ${PREFIX:=-}

# @todo We could complete nc-cmd arguments better if we wanted to
_arguments -s -S -A '-*' : \
  + '(g1)' \
  '(: -)--dns[display current DNS configuration]' \
  '(: -)--get[display specified preference]: :->prefs' \
  '(: -)--nc[interact with VPN connections]: :->nc-cmd:*:argument' \
  '(: -)--prefs[interface with raw preference data]:preference file:_files' \
  '(: -)--proxy[display current proxy configuration]' \
  '(: -)--set[set specified preference]: :->prefs:value' \
  + g2 \
  '(g1 g3)-r[check network reachability]' \
  '(g1 g3)-W[monitor (watch) network reachability]' \
  '(g1 g3)1:host:_hosts' \
  '(g1 g3)2::host:_hosts' \
  + g3 \
  '(g1 g2)-w[wait for key to exist in dynamic store]' \
  '(g1 g2)-t+[specify timeout]:timeout (seconds)' \
&& ret=0

case $state in
  nc-cmd)
    _values command \
      'disablevpn[disable specified service or VPN application type]' \
      'enablevpn[enable specified service or VPN application type]' \
      'help[display command help]' \
      'list[list services]' \
      'ondemand[display VPN on-demand information]' \
      'resume[resume specified service]' \
      'select[make specified service active]' \
      'show[display configuration information for specified service]' \
      'start[start specified service]' \
      'statistics[display statistics for specified service]' \
      'status[display status for specified service]' \
      'stop[stop specified service]' \
      'suspend[suspend specified service]' \
      'trigger[trigger VPN on-demand with specified host]' \
    && ret=0
    ;;
  prefs)
    _values preference ComputerName HostName LocalHostName && ret=0
    ;;
esac

return ret