]> git.ipfire.org Git - thirdparty/systemd.git/blob - shell-completion/zsh/_systemd-inhibit
pkgconfig: define variables relative to ${prefix}/${rootprefix}/${sysconfdir}
[thirdparty/systemd.git] / shell-completion / zsh / _systemd-inhibit
1 #compdef systemd-inhibit
2 # SPDX-License-Identifier: LGPL-2.1+
3
4 _systemd_inhibit_command(){
5 if (( CURRENT == 1 )); then
6 compset -q
7 _normal
8 else
9 local n=${words[(b:2:i)[^-]*]}
10 if (( n <= CURRENT )); then
11 compset -n $n
12 _alternative \
13 'files:file:_files' \
14 'commands:command:_normal' && return 0
15 fi
16 _default
17 fi
18 }
19
20 _inhibit_what() {
21 local _inhibit
22 _inhibit=(shutdown sleep idle handle-power-key handle-suspend-key handle-hibernate-key handle-lid-switch)
23 _values -s : "${_inhibit[@]}"
24 }
25
26 _arguments \
27 {-h,--help}'[Show this help]' \
28 '--version[Show package version]' \
29 '--what=[Operations to inhibit]:options:_inhibit_what' \
30 '--who=[A descriptive string who is inhibiting]:who is inhibiting:' \
31 '--why=[A descriptive string why is being inhibited]:reason for the lock:' \
32 '--mode=[One of block or delay]:lock mode:( block delay )' \
33 '--list[List active inhibitors]' \
34 '*:commands:_systemd_inhibit_command'