summary refs log tree commit diff
path: root/Completion/Unix/Command
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r--Completion/Unix/Command/_runit73
-rw-r--r--Completion/Unix/Command/_xxd45
2 files changed, 118 insertions, 0 deletions
diff --git a/Completion/Unix/Command/_runit b/Completion/Unix/Command/_runit
new file mode 100644
index 000000000..81ba26a44
--- /dev/null
+++ b/Completion/Unix/Command/_runit
@@ -0,0 +1,73 @@
+#compdef sv
+
+_sv_commands() {
+  local -a sv_ary
+  sv_ary=(
+    'status':'get status of service (and log service if available)'
+    'up':'start if service is running. If service stops, restart'
+    'down':'send SIGTERM and SIGCONT if service is running. After it stops, do not restart'
+    'once':'start if service is not running. Do not restart if it stops'
+    'pause':'send SIGSTOP if service is running'
+    'cont':'send SIGCONT if service is running'
+    'hup':'send SIGHUP if service is running'
+    'alarm':'send SIGALRM if service is running'
+    'interrupt':'send SIGINT if service is running'
+    'quit':'send SIGQUIT if service is running'
+    '1':'send SIGUSR1 if service is running'
+    '2':'send SIGUSR2 if service is running'
+    'term':'send SIGTERM if service is running'
+    'kill':'send SIGKILL if service is running'
+    'exit':'send SIGTERM and SIGCONT if service is running. Do not restart service.'
+  )
+  _describe -t commands "sv commands" sv_ary -V sv_commands
+}
+
+_sv_lsb() {
+  local -a sv_lsb_ary
+  sv_lsb_ary=(
+    'start':'up with check/timeout'
+    'stop':'down with check/timeout'
+    'reload':'hup with check'
+    'restart':'down and up with check'
+    'shutdown':'exit with check/timeout'
+    'force-stop':'stop with kill on timeout'
+    'force-reload':'reload with kill on timeout'
+    'force-restart':'restart with kill on timeout'
+    'force-shutdown':'shutdown with kill on timeout'
+    'try-restart':'restart if service is already running'
+  )
+
+  _describe -t lsb-commands "sv LSM init compat" sv_lsb_ary -V sv_init_compat
+}
+
+_sv_additional() {
+  _describe -t additional-commands "sv additional commands" '("check:check status of service")' -V sv_addl_comm
+}
+
+local curcontext="$curcontext" state line
+_arguments -C \
+  '-v[verbose]' \
+  '-w[wait time]:time (seconds)' \
+  '1: :->command' \
+  '*:: :->options'
+
+case $state in
+  (command)
+    _alternative \
+      _sv_commands \
+      _sv_lsb \
+      _sv_additional
+  ;;
+
+  (options)
+    local -a sv_services
+    local svdir=${SVDIR:-/etc/service}
+    sv_services=(
+      $svdir/*(N)
+      $svdir/*/log(N)
+    )
+
+    sv_services=( ${sv_services#$svdir/} )
+    _describe -t services "sv services" sv_services
+  ;;
+esac
diff --git a/Completion/Unix/Command/_xxd b/Completion/Unix/Command/_xxd
new file mode 100644
index 000000000..1a822553c
--- /dev/null
+++ b/Completion/Unix/Command/_xxd
@@ -0,0 +1,45 @@
+#compdef xxd
+
+local arguments
+
+# Output options compatibility matrix
+#
+# 0 - options conflict
+# 1 - options coexist
+#
+# (The matrix is symmetric, so implied values are not shown.)
+#
+#     bEipru
+#    bx10000
+#    E-x0001
+#    i--x001
+#    p---x11
+#    r----x0
+#    u-----x
+
+# xxd supports either double or single dashes on long options.
+[[ -prefix -- ]] && compset -P -
+
+arguments=(
+  # output options
+  '(-b -bits            -i -include -p -postscript -plain -ps -r -reverse -u -uppercase)'{-b,-bits}'[output in binary digits, rather than hex]'
+  '(         -E -EBCDIC -i -include -p -postscript -plain -ps -r -reverse              )'{-E,-EBCDIC}'[print human-readable part in EBCDIC rather than ASCII]'
+  '(-b -bits -E -EBCDIC -i -include -p -postscript -plain -ps -r -reverse              )'{-i,-include}'[output in C include file style]'
+  '(-b -bits -E -EBCDIC -i -include -p -postscript -plain -ps                          )'{-p,-postscript,-plain,-ps}'[read or write a plain hexdump (no line numbers or ASCII rendering)]'
+
+  '(-b -bits -E -EBCDIC -i -include                           -r -reverse -u -uppercase)'{-r,-reverse}'[reverse mode\: read a hex dump and output binary data]'
+  '(-b -bits                                                  -r -reverse -u -uppercase)'{-u,-uppercase}'[output upper-case hex digits]'
+
+  {-h,-help}'[display usage message]'
+  {-v,-version}'[show program version]'
+  '*'{-a,-autoskip}"[a single '*' replaces runs of NUL (toggleable)]"
+
+  {-c+,-cols}'[specify number of octets per line]: :_guard "[0-9a-fA-Fx]#" "number of octets per line"'
+  {-g+,-groupsize}'[specify the number of octets per group]: :_guard "[0-9]#" "number of octets per group"'
+  {-l+,-len}'[specify number of octets to output]: :_guard "[0-9]#" "number of octets to output"'
+  {-s,-skip,-seek}'[specify file offset to dump from]: :_guard "[0-9]#" "file offset to dump from (absolute or relative)"'
+
+  ':files:_files'
+)
+
+_arguments -S $arguments