]>
Commit | Line | Data |
---|---|---|
67e654f8 | 1 | #compdef systemd-inhibit |
7059062c | 2 | # SPDX-License-Identifier: LGPL-2.1+ |
67e654f8 WG |
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 | ||
298b9e23 WG |
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 | ||
67e654f8 WG |
26 | _arguments \ |
27 | {-h,--help}'[Show this help]' \ | |
28 | '--version[Show package version]' \ | |
298b9e23 | 29 | '--what=[Operations to inhibit]:options:_inhibit_what' \ |
fb9d85b7 EC |
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 )' \ | |
67e654f8 WG |
33 | '--list[List active inhibitors]' \ |
34 | '*:commands:_systemd_inhibit_command' |