From a2d4ea00d93a38cfc8d4f29731010fb0c575be83 Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Fri, 23 Dec 2022 15:28:52 +0900 Subject: [PATCH] Add mediumio subcommand completion --- src/_virtualbox | 58 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/src/_virtualbox b/src/_virtualbox index a2e04fb..6d47d47 100644 --- a/src/_virtualbox +++ b/src/_virtualbox @@ -282,7 +282,7 @@ _vboxmanage() { && ret=0 ;; (mediumio) - # TODO + _vboxmanage_mediumio ;; (setproperty) _arguments \ @@ -499,6 +499,62 @@ _vboxmanage_bandwidthctl_set() { '--limit=[Specifies the bandwidth limit for a bandwidth group]:limit' } +(( $+functions[_vboxmanage_mediumio] )) || +_vboxmanage_mediumio() { + local ret=1 + + _arguments -C \ + '1: :(formatfat cat stream)' \ + '*:: :->arg' \ + && ret=0 + + case $state in + (arg) + local subcommand=$words[1] + if (( $+functions[_vboxmanage_mediumio_${subcommand}] )); then + _vboxmanage_mediumio_${subcommand} && ret=0 + fi + ;; + esac + + return $ret +} + +(( $+functions[_vboxmanage_mediumio_formatfat] )) || +_vboxmanage_mediumio_formatfat() { + _arguments \ + '--disk=[Either the UUID or filename of a harddisk image]: :_files' \ + '--dvd=[Either the UUID or filename of a DVD image]: :_files' \ + '--floppy=[Either the UUID or filename of a floppy image]: :_files' \ + '--password-file=[The name of a file containing the medium encryption password]: :_files' \ + '--quick[Quickformat the medium]' +} + +(( $+functions[_vboxmanage_mediumio_cat] )) || +_vboxmanage_mediumio_cat() { + _arguments \ + '--disk=[Either the UUID or filename of a harddisk image]: :_files' \ + '--dvd=[Either the UUID or filename of a DVD image]: :_files' \ + '--floppy=[Either the UUID or filename of a floppy image]: :_files' \ + '--password-file=[The name of a file containing the medium encryption password]: :_files' \ + '--hex[Dump as hex bytes]' \ + '--offset=[The byte offset in the medium to start]:offset' \ + '--size=[The number of bytes to dump]:size' \ + '--output=[The output filename]: :_files' +} + +(( $+functions[_vboxmanage_mediumio_stream] )) || +_vboxmanage_mediumio_stream() { + _arguments \ + '--disk=[Either the UUID or filename of a harddisk image]: :_files' \ + '--dvd=[Either the UUID or filename of a DVD image]: :_files' \ + '--floppy=[Either the UUID or filename of a floppy image]: :_files' \ + '--password-file=[The name of a file containing the medium encryption password]: :_files' \ + '--format=[The format of the destination image]:format' \ + '--variant=[The medium variant for the destination]:variant' \ + '--output=[The output filename]: :_files' +} + (( $+functions[_vboxheadless] )) || _vboxheadless() { local ret=1