]> git.ipfire.org Git - thirdparty/systemd.git/blob - shell-completion/zsh/_bootctl
shutdown: Make all mounts private
[thirdparty/systemd.git] / shell-completion / zsh / _bootctl
1 #compdef bootctl
2 # SPDX-License-Identifier: LGPL-2.1-or-later
3
4 __bootctl() {
5 bootctl --no-pager $@ 2>/dev/null
6 }
7
8 _bootctl_comp_ids() {
9 local expl
10 local -a ids
11 __bootctl list | while read a b; do
12 if [[ "$a" == "id:" ]]; then
13 ids+="$b"
14 fi
15 done
16 _wanted id expl 'boot id' compadd "$@" -a ids
17 }
18
19 _bootctl_set-default() {
20 _bootctl_comp_ids
21 }
22
23 _bootctl_set-oneshot() {
24 _bootctl_comp_ids
25 }
26
27 _bootctl_reboot-to-firmware() {
28 local -a _completions
29 _completions=( yes no )
30 typeset -U _completions
31 _describe 'possible values' _completions
32 }
33
34 (( $+functions[_bootctl_commands] )) || _bootctl_commands()
35 {
36 local -a _bootctl_cmds
37 _bootctl_cmds=(
38 "status:Show status of installed systemd-boot and EFI variables"
39 "install:Install systemd-boot to the ESP and EFI variables"
40 "update:Update systemd-boot in the ESP and EFI variables"
41 "remove:Remove systemd-boot from the ESP and EFI variables"
42 "is-installed:Test whether systemd-boot is installed in the ESP"
43 "random-seed:Initialize random seed in ESP and EFI variables"
44 "systemd-efi-options:Query or set system options string in EFI variable"
45 "reboot-to-firmware:Query or set reboot-to-firmware EFI flag"
46 "list:List boot loader entries"
47 "set-default:Set the default boot loader entry"
48 "set-oneshot:Set the default boot loader entry only for the next boot"
49 "set-timeout:Set the menu timeout"
50 "set-timeout-oneshot:Set the menu timeout for the next boot only"
51 )
52 if (( CURRENT == 1 )); then
53 _describe -t commands 'bootctl command' _bootctl_cmds || compadd "$@"
54 else
55 local curcontext="$curcontext"
56 cmd="${${_bootctl_cmds[(r)$words[1]:*]%%:*}}"
57 if (( $+functions[_bootctl_$cmd] )); then
58 _bootctl_$cmd
59 else
60 _message "no more options"
61 fi
62 fi
63 }
64
65 _arguments \
66 {-h,--help}'[Prints a short help text and exits.]' \
67 '--version[Prints a short version string and exits.]' \
68 '--esp-path=[Path to the EFI System Partition (ESP)]:path:_directories' \
69 '--boot-path=[Path to the $BOOT partition]:path:_directories' \
70 {-p,--print-esp-path}'[Print path to the EFI system partition]' \
71 {-x,--print-boot-path}'[Print path to the $BOOT partition]' \
72 '--make-machine-id-directory=[Control creation and deletion of the top-level machine ID directory.]:options:(yes no auto)' \
73 '--no-variables[Do not touch EFI variables]' \
74 '--no-pager[Do not pipe output into a pager]' \
75 '--graceful[Do not fail when locating ESP or writing fails]' \
76 '--root=[Operate under the specified directory]:PATH' \
77 '--image=[Operate on the specified image]:PATH' \
78 '--install-source[Where to pick files when using --root=/--image=]:options:(image host auto)' \
79 '*::bootctl command:_bootctl_commands'