chiark / gitweb /
bus-proxy: also consider ENOTCONN a clean termination condition
[elogind.git] / shell-completion / zsh / _systemd-inhibit
1 #compdef systemd-inhibit
2
3 _systemd_inhibit_command(){
4     if (( CURRENT == 1 )); then
5         compset -q
6         _normal
7     else
8         local n=${words[(b:2:i)[^-]*]}
9         if (( n <= CURRENT )); then
10             compset -n $n
11             _alternative \
12                 'files:file:_files' \
13                 'commands:command:_normal' && return 0
14         fi
15         _default
16     fi
17 }
18
19 _inhibit_what() {
20     local _inhibit
21     _inhibit=(shutdown sleep idle handle-power-key handle-suspend-key handle-hibernate-key handle-lid-switch)
22     _values -s : "${_inhibit[@]}"
23 }
24
25 _arguments \
26     {-h,--help}'[Show this help]' \
27     '--version[Show package version]' \
28     '--what=[Operations to inhibit]:options:_inhibit_what' \
29     '--who=[A descriptive string who is inhibiting]' \
30     '--why=[A descriptive string why is being inhibited]' \
31     '--mode=[One of block or delay]' \
32     '--list[List active inhibitors]' \
33     '*:commands:_systemd_inhibit_command'