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