mirror of
https://github.com/systemd/systemd.git
synced 2025-02-01 09:47:35 +03:00
shell-completions: update bootctl
Entries in the completion lists are reordered to follow --help output: this makes it much easier to see what is missing.
This commit is contained in:
parent
84190644ff
commit
8f0a346a29
@ -31,7 +31,7 @@ _bootctl() {
|
||||
local i verb comps
|
||||
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
local -A OPTS=(
|
||||
[STANDALONE]='-h --help --no-variables -p --print-esp-path -x --print-boot-path --version --no-pager'
|
||||
[STANDALONE]='-h --help -p --print-esp-path -x --print-boot-path --version --no-variables --no-pager --graceful'
|
||||
[ARG]='--esp-path --boot-path'
|
||||
)
|
||||
|
||||
@ -56,8 +56,10 @@ _bootctl() {
|
||||
fi
|
||||
|
||||
local -A VERBS=(
|
||||
[STANDALONE]='help install list remove status update'
|
||||
# systemd-efi-options takes an argument, but it is free-form, so we cannot complete it
|
||||
[STANDALONE]='help status install update remove is-installed random-seed systemd-efi-options list'
|
||||
[BOOTENTRY]='set-default set-oneshot'
|
||||
[BOOLEAN]='reboot-to-firmware'
|
||||
)
|
||||
|
||||
for ((i=0; i < COMP_CWORD; i++)); do
|
||||
@ -86,6 +88,8 @@ _bootctl() {
|
||||
else
|
||||
comps=''
|
||||
fi
|
||||
elif __contains_word "$verb" ${VERBS[BOOLEAN]}; then
|
||||
comps="yes no"
|
||||
fi
|
||||
|
||||
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
|
||||
|
@ -24,6 +24,13 @@ _bootctl_set-oneshot() {
|
||||
_bootctl_comp_ids
|
||||
}
|
||||
|
||||
_bootctl_reboot-to-firmware() {
|
||||
local -a _completions
|
||||
_completions=( yes no )
|
||||
typeset -U _completions
|
||||
_describe 'possible values' _completions
|
||||
}
|
||||
|
||||
(( $+functions[_bootctl_commands] )) || _bootctl_commands()
|
||||
{
|
||||
local -a _bootctl_cmds
|
||||
@ -32,8 +39,11 @@ _bootctl_set-oneshot() {
|
||||
"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"
|
||||
"random-seed:Initialize random seed in ESP and EFI variables"
|
||||
"is-installed:Test whether systemd-boot is installed in the ESP"
|
||||
"random-seed:Initialize random seed in ESP and EFI variables"
|
||||
"systemd-efi-options:Query or set system options string in EFI variable"
|
||||
"reboot-to-firmware:Query or set reboot-to-firmware EFI flag"
|
||||
"list:List boot loader entries"
|
||||
"set-default:Set the default boot loader entry"
|
||||
"set-oneshot:Set the default boot loader entry only for the next boot"
|
||||
)
|
||||
@ -59,4 +69,5 @@ _arguments \
|
||||
{-x,--print-boot-path}'[Print path to the $BOOT partition]' \
|
||||
'--no-variables[Do not touch EFI variables]' \
|
||||
'--no-pager[Do not pipe output into a pager]' \
|
||||
'--graceful[Do not fail when locating ESP or writing fails]' \
|
||||
'*::bootctl command:_bootctl_commands'
|
||||
|
Loading…
x
Reference in New Issue
Block a user