67e654f83021a1b3ed55f4b75936d03591bf80c1William Giokas#compdef systemd-inhibit
67e654f83021a1b3ed55f4b75936d03591bf80c1William Giokas_systemd_inhibit_command(){
67e654f83021a1b3ed55f4b75936d03591bf80c1William Giokas if (( CURRENT == 1 )); then
67e654f83021a1b3ed55f4b75936d03591bf80c1William Giokas local n=${words[(b:2:i)[^-]*]}
67e654f83021a1b3ed55f4b75936d03591bf80c1William Giokas if (( n <= CURRENT )); then
67e654f83021a1b3ed55f4b75936d03591bf80c1William Giokas compset -n $n
67e654f83021a1b3ed55f4b75936d03591bf80c1William Giokas _alternative \
67e654f83021a1b3ed55f4b75936d03591bf80c1William Giokas 'files:file:_files' \
67e654f83021a1b3ed55f4b75936d03591bf80c1William Giokas 'commands:command:_normal' && return 0
298b9e23a6e21161a7fe486aab94944a58d5e90cWilliam Giokas_inhibit_what() {
298b9e23a6e21161a7fe486aab94944a58d5e90cWilliam Giokas local _inhibit
298b9e23a6e21161a7fe486aab94944a58d5e90cWilliam Giokas _inhibit=(shutdown sleep idle handle-power-key handle-suspend-key handle-hibernate-key handle-lid-switch)
298b9e23a6e21161a7fe486aab94944a58d5e90cWilliam Giokas _values -s : "${_inhibit[@]}"
67e654f83021a1b3ed55f4b75936d03591bf80c1William Giokas {-h,--help}'[Show this help]' \
67e654f83021a1b3ed55f4b75936d03591bf80c1William Giokas '--version[Show package version]' \
298b9e23a6e21161a7fe486aab94944a58d5e90cWilliam Giokas '--what=[Operations to inhibit]:options:_inhibit_what' \
fb9d85b71ac1a9247af623f98f4e229fccd0fe7dEric Cook '--who=[A descriptive string who is inhibiting]:who is inhibiting:' \
fb9d85b71ac1a9247af623f98f4e229fccd0fe7dEric Cook '--why=[A descriptive string why is being inhibited]:reason for the lock:' \
fb9d85b71ac1a9247af623f98f4e229fccd0fe7dEric Cook '--mode=[One of block or delay]:lock mode:( block delay )' \
67e654f83021a1b3ed55f4b75936d03591bf80c1William Giokas '--list[List active inhibitors]' \
67e654f83021a1b3ed55f4b75936d03591bf80c1William Giokas '*:commands:_systemd_inhibit_command'