summaryrefslogtreecommitdiff
path: root/shell-completion/zsh/_machinectl
diff options
context:
space:
mode:
Diffstat (limited to 'shell-completion/zsh/_machinectl')
-rw-r--r--shell-completion/zsh/_machinectl16
1 files changed, 9 insertions, 7 deletions
diff --git a/shell-completion/zsh/_machinectl b/shell-completion/zsh/_machinectl
index a00fc91021..4561e4db75 100644
--- a/shell-completion/zsh/_machinectl
+++ b/shell-completion/zsh/_machinectl
@@ -1,13 +1,15 @@
#compdef machinectl
# SPDX-License-Identifier: LGPL-2.1+
-__get_available_machines () {
+(( $+functions[__machinectl_get_machines] )) ||
+__machinectl_get_machines () {
machinectl --no-legend list-images | {while read -r a b; do echo $a; done;}
}
-_available_machines() {
+(( $+functions[_machinectl_machines] )) ||
+_machinectl_machines() {
local -a _machines
- _machines=("${(fo)$(__get_available_machines)}")
+ _machines=("${(fo)$(__machinectl_get_machines)}")
typeset -U _machines
if [[ -n "$_machines" ]]; then
_describe 'machines' _machines
@@ -16,7 +18,7 @@ _available_machines() {
fi
}
-(( $+functions[_machinectl_command] )) || _machinectl_command()
+(( $+functions[_machinectl_commands] )) || _machinectl_commands()
{
local -a _machinectl_cmds
_machinectl_cmds=(
@@ -61,9 +63,9 @@ _available_machines() {
list*|cancel-transfer|pull-tar|pull-raw)
msg="no options" ;;
clone)
- _available_machines ;;
+ _machinectl_machines ;;
start)
- _available_machines ;;
+ _machinectl_machines ;;
*)
_sd_machines
esac
@@ -100,4 +102,4 @@ _arguments \
{-o+,--output=}'[Change journal output mode.]:output modes:_sd_outputmodes' \
'--verify=[Verification mode for downloaded images.]:verify:(no checksum signature)' \
'--force[Download image even if already exists.]' \
- '*::machinectl command:_machinectl_command'
+ '*::machinectl command:_machinectl_commands'