summary refs log tree commit diff
path: root/Completion/Darwin/Command/_scutil
diff options
context:
space:
mode:
authordana <dana@dana.is>2018-01-05 14:26:17 -0600
committerOliver Kiddle <opk@zsh.org>2018-01-06 00:13:51 +0100
commit0f0b602415961aa9ca069c9719a0fbb4bbb9941f (patch)
tree03001cfaf7ed12c26a354a996f52c4920d08cb76 /Completion/Darwin/Command/_scutil
parent0c5f851021b3aacea96d9ca446282b8dab9f260d (diff)
downloadzsh-0f0b602415961aa9ca069c9719a0fbb4bbb9941f.tar.gz
zsh-0f0b602415961aa9ca069c9719a0fbb4bbb9941f.tar.xz
zsh-0f0b602415961aa9ca069c9719a0fbb4bbb9941f.zip
42231: new completion functions for simple utilities belonging to the 'Darwin' and 'Linux' groups.
Diffstat (limited to 'Completion/Darwin/Command/_scutil')
-rw-r--r--Completion/Darwin/Command/_scutil56
1 files changed, 56 insertions, 0 deletions
diff --git a/Completion/Darwin/Command/_scutil b/Completion/Darwin/Command/_scutil
new file mode 100644
index 000000000..6c0a84d64
--- /dev/null
+++ b/Completion/Darwin/Command/_scutil
@@ -0,0 +1,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