diff options
author | Marko Myllynen <myllynen@redhat.com> | 2013-11-13 23:02:23 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-11-13 23:02:23 -0500 |
commit | 51d0f1c9f6a378f3bf11179e5794dc2c13b49644 (patch) | |
tree | 361dd3a4e55eaa3f8e5d46b62b19da2f1bb1d0d3 | |
parent | 1bc64d77352010f6951e7cccf77be99301e9664c (diff) |
zsh-completion: add bootctl
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | shell-completion/zsh/_bootctl | 25 |
2 files changed, 29 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am index 789ca026b0..558aa1bf0f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1730,6 +1730,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 0000000000..7d2453cc2c --- /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' |