| 1 |
#compdef systemd-inhibit |
| 2 |
# SPDX-License-Identifier: LGPL-2.1-or-later |
| 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 |
'--no-pager[Do not pipe output into a pager]' \ |
| 32 |
'--no-legend[Do not show the headers and footers]' \ |
| 33 |
'--what=[Operations to inhibit]:options:_systemd-inhibit_what' \ |
| 34 |
'--who=[A descriptive string who is inhibiting]:who is inhibiting:' \ |
| 35 |
'--why=[A descriptive string why is being inhibited]:reason for the lock:' \ |
| 36 |
'--mode=[One of block, block-weak, or delay]:lock mode:( block block-weak delay )' \ |
| 37 |
'--list[List active inhibitors]' \ |
| 38 |
'*:commands:_systemd-inhibit_commands' |