]>
Commit | Line | Data |
---|---|---|
439b7ce8 WG |
1 | #compdef machinectl |
2 | ||
3 | (( $+functions[_machinectl_command] )) || _machinectl_command() | |
4 | { | |
5 | local -a _machinectl_cmds | |
6 | _machinectl_cmds=( | |
7 | "list:List currently running VMs/containers" | |
8 | "status:Show VM/container status" | |
9 | "show:Show properties of one or more VMs/containers" | |
4433c995 DM |
10 | "login:Get a login prompt on a VM/container" |
11 | "poweroff:Power off one or more VMs/containers" | |
12 | "reboot:Reboot one or more VMs/containers" | |
439b7ce8 WG |
13 | "terminate:Terminate one or more VMs/containers" |
14 | "kill:Send signal to process or a VM/container" | |
15 | ) | |
16 | if (( CURRENT == 1 )); then | |
17 | _describe -t commands 'machinectl command' _machinectl_cmds || compadd "$@" | |
18 | else | |
19 | local curcontext="$curcontext" | |
20 | cmd="${${_machinectl_cmds[(r)$words[1]:*]%%:*}}" | |
21 | if (( $#cmd )); then | |
22 | case $cmd in | |
23 | list) msg="no options" ;; | |
24 | *) | |
c0fd7cbd | 25 | _sd_machines |
439b7ce8 WG |
26 | esac |
27 | else | |
28 | _message "no more options" | |
29 | fi | |
30 | fi | |
31 | } | |
32 | ||
33 | _arguments \ | |
34 | {-h,--help}'[Prints a short help text and exits.]' \ | |
35 | '--version[Prints a short version string and exits.]' \ | |
862f4963 | 36 | \*{-p+,--property=}'[Limit output to specified property.]:property:(Name Id Timestamp TimestampMonotonic Service Scope Leader Class State RootDirectory)' \ |
439b7ce8 WG |
37 | {-a,--all}'[Show all proerties]' \ |
38 | (-l,--full)'[Do not ellipsize cgroup members]' \ | |
39 | '--no-pager[Do not pipe output into a pager]' \ | |
40 | '--no-ask-password[Do not ask for system passwords]' \ | |
41 | '--kill-who=[Who to send signal to]:killwho:(leader all)' \ | |
862f4963 | 42 | {-s+,--signal=}'[Which signal to send]:signal:_signals' \ |
6da49b8b | 43 | {-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \ |
439b7ce8 WG |
44 | {-P,--privileged}'[Acquire privileges before execution]' \ |
45 | '*::machinectl command:_machinectl_command' |