1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-05 06:52:22 +03:00
systemd/shell-completion/zsh/_bootctl
dana c501ecd70c zsh completion: Prevent functions from clobbering each other, &c.
- Don't redefine helpers on every call
- Prefix helper names with main function name
- Adjust some helper names for consistency and convention adherance
2019-01-08 15:23:37 +01:00

32 lines
1.1 KiB
Plaintext

#compdef bootctl
# SPDX-License-Identifier: LGPL-2.1+
(( $+functions[_bootctl_commands] )) || _bootctl_commands()
{
local -a _bootctl_cmds
_bootctl_cmds=(
"status:Show status of installed systemd-boot and EFI variables"
"install:Install systemd-boot to the ESP and EFI variables"
"update:Update systemd-boot in the ESP and EFI variables"
"remove:Remove systemd-boot from the ESP and EFI variables"
)
if (( CURRENT == 1 )); then
_describe -t commands 'bootctl command' _bootctl_cmds || compadd "$@"
else
local curcontext="$curcontext"
cmd="${${_bootctl_cmds[(r)$words[1]:*]%%:*}}"
if (( $+functions[_bootctl_$cmd] )); then
_bootctl_$cmd
else
_message "no more options"
fi
fi
}
_arguments \
{-h,--help}'[Prints a short help text and exits.]' \
'--version[Prints a short version string and exits.]' \
'--path=[Path to the EFI System Partition (ESP)]:path:_directories' \
'--no-variables[Do not touch EFI variables]' \
'*::bootctl command:_bootctl_commands'