_machinectl revision 439b7ce868810427712ca146b94b7fb004abfbb4
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas#compdef machinectl
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas(( $+functions[_machinectl_command] )) || _machinectl_command()
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas local -a _machinectl_cmds
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas _machinectl_cmds=(
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas "list:List currently running VMs/containers"
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas "status:Show VM/container status"
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas "show:Show properties of one or more VMs/containers"
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas "terminate:Terminate one or more VMs/containers"
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas "kill:Send signal to process or a VM/container"
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas if (( CURRENT == 1 )); then
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas _describe -t commands 'machinectl command' _machinectl_cmds || compadd "$@"
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas local curcontext="$curcontext"
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas cmd="${${_machinectl_cmds[(r)$words[1]:*]%%:*}}"
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas if (( $#cmd )); then
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas list) msg="no options" ;;
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas _machines=( "${(foa)$(machinectl list | awk '{print $1}')}" )
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas if [[ -n "$_machines" ]]; then
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas _describe 'machines' _machines
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas _message 'no machines'
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas _message "no more options"
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas {-h,--help}'[Prints a short help text and exits.]' \
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas '--version[Prints a short version string and exits.]' \
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas {-p,--property=}'[Limit output to specified property.]:property:(Name Id Timestamp TimestampMonotonic Service Scope Leader Class State RootDirectory)' \
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas {-a,--all}'[Show all proerties]' \
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas (-l,--full)'[Do not ellipsize cgroup members]' \
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas '--no-pager[Do not pipe output into a pager]' \
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas '--no-ask-password[Do not ask for system passwords]' \
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas '--kill-who=[Who to send signal to]:killwho:(leader all)' \
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas {-s,--signal=}'[Which signal to send]:signal:_signals' \
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas {-H,--host=}'[Show information for remote host]:userathost:_hosts_or_user_at_host' \
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas {-P,--privileged}'[Acquire privileges before execution]' \
439b7ce868810427712ca146b94b7fb004abfbb4William Giokas '*::machinectl command:_machinectl_command'