about summary refs log tree commit diff
path: root/Completion/Unix/Command/_shutdown
blob: a237b14e02606e8dad588820020262ed35159acc (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#compdef shutdown

local -a args

if [[ -d /etc/systemd ]]; then
  _arguments \
    '--help[display usage information]' \
    '(-H --halt)'{-H,--halt}'[halt the machine]' \
    '(-P --poweroff -h)'{-P,--poweroff,-h}'[power-off the machine (default)]' \
    '(-r --reboot)'{-r,--reboot}'[reboot the machine]' \
    "(--no-wall)-k[don't shutdown, just write wall message]" \
    "(-k)--no-wall[don't send a wall message]" \
    '-c[cancel pending shutdown]' \
    '1: :_guard "^-*" "time (now/hh\:mm/+mins)"' \
    '*:warning message'
  return
fi

case $OSTYPE in
  *bsd*|dragonfly*|linux*|darwin*)
    args=(
      '-h[halt the system after shutdown]'
      '-r[reboot the system]'
      '-k[kick everybody off]'
      '-n[prevent file system cache from being flushed]'
      '1: :_guard "^-*" "time (now/hh\:mm/+mins)"'
      '*:warning message'
    )
  ;|
  *bsd*|dragonfly*)
    args+=(
      '-p[turn off power after shutdown]'
    )
  ;|
  (net|open)bsd*)
    args+=(
      '-d[cause system to perform a dump]'
      '-f[create /fastboot so that file systems will not be checked during the next boot]'
    )
  ;|
  freebsd*|dragonfly*)
    args+=(
      '-o[execute halt or reboot instead of sending a signal to init]'
    )
  ;|
  freebsd<12->.*)
    args+=(
      '-c[power cycle the system instead of halting if possible]'
    )
  ;;
  netbsd*)
    args+=(
      '-b[specify boot string to pass to reboot]:boot string'
      '-v[enable verbose console messages]'
      '-x[enable debug console messages]'
      '-z[silence some console messages]'
      '-D[prevent shutdown from detaching from the tty]'
    )
  ;;
  darwin*)
    args+=(
      '-o[execute halt or reboot instead of sending a signal to launchd]'
      '-s[put the system to sleep]'
      '-u[with -h, wait 5 minutes before removing power]'
    )
  ;;
  solaris2.<11->) args=( '(-i)-r[reboot]' ) ;&
  solaris*)
    args+=(
      '(-r)-i+[specify init-state]:init state:((0\:stop 1\:administrative s\:single\ user 5 6\:reboot))'
      '-y[pre-answer yes to confirmation question]'
      '-g+[specify grace period]:grace period (seconds) [60]'
    )
  ;;
esac

_arguments $args