From 337c43064e5cbd4496a00f5f805106ae19fd4c83 Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Sun, 25 Dec 2022 12:56:22 +0900 Subject: [PATCH] Add hostonlyif subcommand completion --- src/_virtualbox | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/_virtualbox b/src/_virtualbox index 13c13d1..b2cf393 100644 --- a/src/_virtualbox +++ b/src/_virtualbox @@ -312,7 +312,7 @@ _vboxmanage() { _vboxmanage_natnetwork && ret=0 ;; (hostonlyif) - # TODO + _vboxmanage_hostonlyif && ret=0 ;; (hostonlynet) # TODO @@ -1290,6 +1290,34 @@ _vboxmanage_natnetwork() { return $ret } +(( $+functions[_vboxmanage_hostonlyif] )) || +_vboxmanage_hostonlyif() { + local ret=1 + + _arguments -C \ + '1: :(ipconfig create remove)' \ + '*:: :->arg' \ + && ret=0 + + case $state in + (arg) + case $words[1] in + (ipconfig) + _arguments \ + '--dhcp[Uses DHCP for the network interface]' \ + '--ip=[Specifies the IPv4 IP address for the network interface]:ipv4' \ + '--netmask=[Specifies the IPv4 netmask of the network interface]:v4mask' \ + '--ipv6=[Specifies the IPv6 IP address for the network interface]:ipv6' \ + '--netmasklengthv6=[Specifies the length of the IPv6 network interface]:length' \ + && ret=0 + ;; + esac + ;; + esac + + return $ret +} + (( $+functions[_vboxmanage_usbdevsource] )) || _vboxmanage_usbdevsource() { local ret=1