systemd/0100-zsh-completion-add-bootctl.patch

58 lines
1.6 KiB
Diff
Raw Normal View History

2013-11-19 22:28:44 +00:00
From 99f96571a3a7667ab6f3a46944c267bcc7c980e6 Mon Sep 17 00:00:00 2001
From: Marko Myllynen <myllynen@redhat.com>
Date: Wed, 13 Nov 2013 23:02:23 -0500
Subject: [PATCH] zsh-completion: add bootctl
---
Makefile.am | 4 ++++
shell-completion/zsh/_bootctl | 25 +++++++++++++++++++++++++
2 files changed, 29 insertions(+)
create mode 100644 shell-completion/zsh/_bootctl
diff --git a/Makefile.am b/Makefile.am
index b4fc33b..efe5aa3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1743,6 +1743,10 @@ bootctl_LDADD = \
bin_PROGRAMS += \
bootctl
+
+dist_zshcompletion_DATA += \
+ shell-completion/zsh/_bootctl
+
endif
# ------------------------------------------------------------------------------
diff --git a/shell-completion/zsh/_bootctl b/shell-completion/zsh/_bootctl
new file mode 100644
index 0000000..7d2453c
--- /dev/null
+++ b/shell-completion/zsh/_bootctl
@@ -0,0 +1,25 @@
+#compdef bootctl
+
+(( $+functions[_bootctl_command] )) || _bootctl_command()
+{
+ local -a _bootctl_cmds
+ _bootctl_cmds=(
+ "status:Show current firmware and boot settings"
+ )
+ 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.]' \
+ '*::bootctl command:_bootctl_command'