diff options
author | Matthew Martin <phy1729@gmail.com> | 2018-04-06 20:08:40 -0500 |
---|---|---|
committer | Oliver Kiddle <okiddle@yahoo.co.uk> | 2018-04-07 11:06:24 +0200 |
commit | a2cb9bbed3b0787cbea62d6a04083ff24e4f5a27 (patch) | |
tree | d07b5a43366f491e127928cd0617bdbf0015ef81 /Completion/BSD/Command/_vmctl | |
parent | 5e10acca9812df07cc5f02bcbfea22ca7092c1ad (diff) | |
download | zsh-a2cb9bbed3b0787cbea62d6a04083ff24e4f5a27.tar.gz zsh-a2cb9bbed3b0787cbea62d6a04083ff24e4f5a27.tar.xz zsh-a2cb9bbed3b0787cbea62d6a04083ff24e4f5a27.zip |
42604: new completions for OpenBSD's signify and vmctl
Diffstat (limited to 'Completion/BSD/Command/_vmctl')
-rw-r--r-- | Completion/BSD/Command/_vmctl | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/Completion/BSD/Command/_vmctl b/Completion/BSD/Command/_vmctl new file mode 100644 index 000000000..4e66c2383 --- /dev/null +++ b/Completion/BSD/Command/_vmctl @@ -0,0 +1,79 @@ +#compdef vmctl + +local context line state state_descr +local -a subcommands vmctl_status +local -A opt_args + +_vm_name() { + compadd "$@" - ${${${(@f)"$(_call_program vmctl_status vmctl status)"}[2,-1]}##* } +} + +_vm_switch() { + [[ -r /etc/vm.conf ]] && + compadd "$@" - ${${${(M)${(f)"$(</etc/vm.conf)"}:#switch *}##switch ##\"#}%%\"# *} +} + +subcommands=( + console:'connect to the console of the VM' + create:'create a VM disk image' + load:'load additional configuration' + log:'change logging verbosity' + pause:'pause a VM' + receive:'receive a VM from stdin' + reload:'remove stopped VMs and reload config' + reset:'reset specified component' + send:'send VM to stdout and terminate it' + {show,status}:'list VMs running or just the specified id' + start:'start a VM' + stop:'stop a VM' + unpause:'unpause a VM' +) + +if (( CURRENT == 2 )); then + _describe subcommand subcommands +else + shift words; (( CURRENT-- )) + case $words[1] in + console|pause|send|show|status|stop|unpause) + _arguments ':id:_vm_name' + ;; + create) + _arguments \ + ':path:_files' \ + ': :(-s)' \ + ':disk size in megabytes: ' + ;; + load) + _arguments ':configuration file:_files' + ;; + log) + _arguments ':logging verbosity:(brief verbose)' + ;; + receive) + _arguments ':name: ' + ;; + reset) + _arguments ':reset option:(( + all\:"reset the running state" + switches\:"reset the configured switches" + vms\:"reset and terminate all VMs" + ))' + ;; + start) + if (( CURRENT == 2 )); then + _vm_name + else + shift words; (( CURRENT-- )) + _arguments -s \ + '-b+[boot with the specified kernel or BIOS image]:boot image:_files' \ + '-c[automatically connect to the VM console]' \ + '*-d+[disk image file]:disk image:_files' \ + '-i+[number of network interfaces]:number: ' \ + '-L[add a local network interface]' \ + '-m+[memory size in megabytes]:megabytes: ' \ + '-n+[specify switch to attach]:switch:_vm_switch' \ + '-r+[ISO image file for virtual CD-ROM]:ISO image:_files' + fi + ;; + esac +fi |