chiark / gitweb /
completion/systemctl: add missing list-sockets verb
[elogind.git] / shell-completion / zsh / _machinectl
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"
10     "terminate:Terminate one or more VMs/containers"
11     "kill:Send signal to process or a VM/container"
12   )
13   if (( CURRENT == 1 )); then
14     _describe -t commands 'machinectl command' _machinectl_cmds || compadd "$@"
15   else
16     local curcontext="$curcontext"
17     cmd="${${_machinectl_cmds[(r)$words[1]:*]%%:*}}"
18     if (( $#cmd )); then
19       case $cmd in
20         list) msg="no options" ;;
21         *)
22           _machines=( "${(foa)$(machinectl list | awk '{print $1}')}" )
23           if [[ -n "$_machines" ]]; then
24             _describe 'machines' _machines
25           else
26             _message 'no machines'
27           fi
28       esac
29     else
30       _message "no more options"
31     fi
32   fi
33 }
34
35 _arguments \
36   {-h,--help}'[Prints a short help text and exits.]' \
37   '--version[Prints a short version string and exits.]' \
38   \*{-p+,--property=}'[Limit output to specified property.]:property:(Name Id Timestamp TimestampMonotonic Service Scope Leader Class State RootDirectory)' \
39   {-a,--all}'[Show all proerties]' \
40   (-l,--full)'[Do not ellipsize cgroup members]' \
41   '--no-pager[Do not pipe output into a pager]' \
42   '--no-ask-password[Do not ask for system passwords]' \
43   '--kill-who=[Who to send signal to]:killwho:(leader all)' \
44   {-s+,--signal=}'[Which signal to send]:signal:_signals' \
45   {-H+,--host=}'[Show information for remote host]:userathost:_sd_hosts_or_user_at_host' \
46   {-P,--privileged}'[Acquire privileges before execution]' \
47   '*::machinectl command:_machinectl_command'