From f20a81f8130c3373078906fa395771bcd188d5d4 Mon Sep 17 00:00:00 2001 From: "Pedro A. Aranda Gutierrez" Date: Tue, 25 Jan 2022 17:29:23 +0100 Subject: [PATCH 1/4] Add (unCamelised) vboxmanage for Linux --- src/_virtualbox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_virtualbox b/src/_virtualbox index 833be61..028dc7f 100644 --- a/src/_virtualbox +++ b/src/_virtualbox @@ -1,4 +1,4 @@ -#compdef VBoxManage=vboxmanage VBoxHeadless=vboxheadless +#compdef VBoxManage=vboxmanage VBoxHeadless=vboxheadless vboxmanage=vboxmanage # ------------------------------------------------------------------------------ # Description # ----------- From c83b6a505b7e1d0a0b5e76c4f93c2177d91a44d9 Mon Sep 17 00:00:00 2001 From: "Pedro A. Aranda Gutierrez" Date: Tue, 25 Jan 2022 17:30:35 +0100 Subject: [PATCH 2/4] Add function to list natnetworks --- src/_virtualbox | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/_virtualbox b/src/_virtualbox index 028dc7f..4d50e6e 100644 --- a/src/_virtualbox +++ b/src/_virtualbox @@ -21,6 +21,14 @@ _vboxmachines() { done } +# Get natnetworks +_vboxnatnets() { + vboxmanage list natnetworks | awk -F: '/NetworkName:/{print $2}'| while read natnet; do + _wanted 'natnet' expl 'natnet' compadd $natnet + done +} + + # Roughly guess command options _vboxcommandoptions() { cmd="$1" From b3469afc2434fdd02d40ed1caea2ea17eada87a5 Mon Sep 17 00:00:00 2001 From: "Pedro A. Aranda Gutierrez" Date: Tue, 25 Jan 2022 17:31:53 +0100 Subject: [PATCH 3/4] Add initial support for natnetwork subcommand --- src/_virtualbox | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/_virtualbox b/src/_virtualbox index 4d50e6e..f09ae8d 100644 --- a/src/_virtualbox +++ b/src/_virtualbox @@ -274,6 +274,16 @@ _vboxmanage() { '--readonly' \ '--automount' ;; + natnetwork) + _arguments \ + ':action:(add modify remove start stop)' \ + '--netname:natnet:_vboxnatnets' \ + '--dhcp:bool:(on off)' \ + '--ipv6:bool:(on off)' \ + '--enable' \ + '--disable' + ;; + esac return 1 } From 2c3b218d2491da941c86d00df7ee7e0b6130fcd2 Mon Sep 17 00:00:00 2001 From: "Pedro A. Aranda Gutierrez" Date: Tue, 25 Jan 2022 19:58:48 +0100 Subject: [PATCH 4/4] Add list natnets and natnetwork option --- src/_virtualbox | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/_virtualbox b/src/_virtualbox index f09ae8d..5f25b56 100644 --- a/src/_virtualbox +++ b/src/_virtualbox @@ -21,14 +21,12 @@ _vboxmachines() { done } -# Get natnetworks _vboxnatnets() { vboxmanage list natnetworks | awk -F: '/NetworkName:/{print $2}'| while read natnet; do _wanted 'natnet' expl 'natnet' compadd $natnet done } - # Roughly guess command options _vboxcommandoptions() { cmd="$1" @@ -135,6 +133,7 @@ _vboxmanage() { 'hostonlyif:change the IP configuration of a host-only network interface' 'dhcpserver:control the DHCP server that is built into VirtualBox' 'extpack:add or remove VirtualBox extension packs' + 'natnetwork:add,modify,remove or start NatNetworks' ) local context state line expl @@ -151,7 +150,7 @@ _vboxmanage() { list) _arguments \ '--long' \ - ':list option:(vms runningvms ostypes hostdvds hostfloppies bridgedifs hostonlyifs dhcpservers hostinfo hostcpuids hddbackends hdds dvds floppies usbhost usbfilters systemproperties extpacks)' + ':list option:(vms runningvms ostypes hostdvds hostfloppies bridgedifs hostonlyifs dhcpservers hostinfo hostcpuids hddbackends hdds dvds floppies usbhost usbfilters systemproperties natnetworks extpacks)' ;; showvminfo) _arguments \