]> git.ipfire.org Git - thirdparty/systemd.git/blame - shell-completion/zsh/_systemd-inhibit
Merge pull request #11827 from keszybz/pkgconfig-variables
[thirdparty/systemd.git] / shell-completion / zsh / _systemd-inhibit
CommitLineData
67e654f8 1#compdef systemd-inhibit
7059062c 2# SPDX-License-Identifier: LGPL-2.1+
67e654f8 3
c501ecd7 4(( $+functions[_systemd-inhibit_commands] )) ||
5_systemd-inhibit_commands(){
67e654f8
WG
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
c501ecd7 21(( $+functions[_systemd-inhibit_what] )) ||
22_systemd-inhibit_what() {
298b9e23
WG
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
67e654f8
WG
28_arguments \
29 {-h,--help}'[Show this help]' \
30 '--version[Show package version]' \
298b9e23 31 '--what=[Operations to inhibit]:options:_inhibit_what' \
fb9d85b7
EC
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 )' \
67e654f8 35 '--list[List active inhibitors]' \
c501ecd7 36 '*:commands:_systemd-inhibit_commands'