2013-07-29 19:13:29 +00:00
#compdef machinectl
(( $+functions[_machinectl_command] )) || _machinectl_command()
{
local -a _machinectl_cmds
_machinectl_cmds=(
"list:List currently running VMs/containers"
"status:Show VM/container status"
"show:Show properties of one or more VMs/containers"
2014-03-25 19:28:31 +00:00
"login:Get a login prompt on a VM/container"
"poweroff:Power off one or more VMs/containers"
"reboot:Reboot one or more VMs/containers"
2013-07-29 19:13:29 +00:00
"terminate:Terminate one or more VMs/containers"
"kill:Send signal to process or a VM/container"
)
if (( CURRENT == 1 )); then
_describe -t commands 'machinectl command' _machinectl_cmds || compadd "$@"
else
local curcontext="$curcontext"
cmd="${${_machinectl_cmds[(r)$words[1]:*]%%:*}}"
if (( $#cmd )); then
case $cmd in
list) msg="no options" ;;
*)
2013-11-07 22:00:51 +00:00
_sd_machines
2013-07-29 19:13:29 +00:00
esac
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.]' \
2013-08-21 03:06:54 +00:00
\*{-p+,--property=}'[Limit output to specified property.]:property:(Name Id Timestamp TimestampMonotonic Service Scope Leader Class State RootDirectory)' \
2013-07-29 19:13:29 +00:00
{-a,--all}'[Show all proerties]' \
(-l,--full)'[Do not ellipsize cgroup members]' \
'--no-pager[Do not pipe output into a pager]' \
'--no-ask-password[Do not ask for system passwords]' \
'--kill-who=[Who to send signal to]:killwho:(leader all)' \
2013-08-21 03:06:54 +00:00
{-s+,--signal=}'[Which signal to send]:signal:_signals' \
2013-12-01 03:31:31 +00:00
{-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \
2013-07-29 19:13:29 +00:00
{-P,--privileged}'[Acquire privileges before execution]' \
'*::machinectl command:_machinectl_command'