]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shell-completions: update bootctl
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 30 May 2020 14:04:00 +0000 (16:04 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 30 May 2020 14:04:43 +0000 (16:04 +0200)
Entries in the completion lists are reordered to follow --help output:
this makes it much easier to see what is missing.

shell-completion/bash/bootctl
shell-completion/zsh/_bootctl

index 27b73900f736d1b6701ee4b797790fde523a6037..9fc6cb3df544d50dcba42d88bc8f6740ee23adae 100644 (file)
@@ -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") )
index a84601ae6597baee6ff1576467367a652c165d81..fc051bd87d05a908d5ab30b8d8e7f247f4f507cb 100644 (file)
@@ -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'