Reduce functions

This commit is contained in:
Shohei YOSHIDA 2022-12-25 13:06:35 +09:00
parent 4c66875a7b
commit 9035bfb0a8
No known key found for this signature in database
GPG Key ID: C9A1BB11BB940CF2
1 changed files with 74 additions and 90 deletions

View File

@ -282,7 +282,7 @@ _vboxmanage() {
&& ret=0 && ret=0
;; ;;
(mediumio) (mediumio)
_vboxmanage_mediumio _vboxmanage_mediumio && ret=0
;; ;;
(setproperty) (setproperty)
_arguments \ _arguments \
@ -426,35 +426,28 @@ _vboxmanage_encryptvm() {
case $state in case $state in
(arg) (arg)
local subcommand=$words[2] compset -n 2
if (( $+functions[_vboxmanage_encryptvm_${subcommand}] )); then case $words[1] in
compset -n 2 (setencryption)
_vboxmanage_encryptvm_${subcommand} && ret=0 _arguments \
else '--cipher[specify the new cipher for encryption of the VM]: :(AES-128 AES-256)' \
_arguments '*: :_files' && ret=0 '--new-password[specify the new password for encryption of the VM]: :_files' \
fi '--new-password-id[specify the new ID for the password for encryption of the VM]:id' \
;; '--force[make the system to reencrypt the VM instead of the simple changing the password]' \
&& ret=0
;;
(addpassword)
_arguments \
'--new-password[specify the new password for encryption of the VM]: :_files' \
'--new-password-id[specify the new ID for the password for encryption of the VM]:id' \
&& ret=0
;;
esac
esac esac
return $ret return $ret
} }
(( $+functions[_vboxmanage_encryptvm_setencryption] )) ||
_vboxmanage_encryptvm_setencryption() {
_arguments \
'--cipher[specify the new cipher for encryption of the VM]: :(AES-128 AES-256)' \
'--new-password[specify the new password for encryption of the VM]: :_files' \
'--new-password-id[specify the new ID for the password for encryption of the VM]:id' \
'--force[make the system to reencrypt the VM instead of the simple changing the password]'
}
(( $+functions[_vboxmanage_encryptvm_addpassword] )) ||
_vboxmanage_encryptvm_addpassword() {
_arguments \
'--new-password[specify the new password for encryption of the VM]: :_files' \
'--new-password-id[specify the new ID for the password for encryption of the VM]:id'
}
(( $+functions[_vboxmanage_cloud] )) || (( $+functions[_vboxmanage_cloud] )) ||
_vboxmanage_cloud() { _vboxmanage_cloud() {
local ret=1 local ret=1
@ -793,38 +786,34 @@ _vboxmanage_bandwidthctl() {
case $state in case $state in
(arg) (arg)
local subcommand=$words[2] compset -n 2
if (( $+functions[_vboxmanage_bandwidthctl_${subcommand}] )); then case $words[1] in
compset -n 2 (add)
_vboxmanage_bandwidthctl_${subcommand} && ret=0 _arguments \
else '--limit=[Specifies the bandwidth limit for a bandwidth group]:limit' \
_arguments '*: :_files' && ret=0 '--type=[Specifies the type of the bandwidth group]: :(disk network)' \
fi && ret=0
;;
(list)
_arguments \
'--machinereadable[Outputs the information about the bandwidth groups in name-value pairs]' \
&& ret=0
;;
(set)
_arguments \
'--limit=[Specifies the bandwidth limit for a bandwidth group]:limit' \
&& ret=0
;;
(*)
_arguments '*: :_files' && ret=0
;;
esac
;; ;;
esac esac
return $ret return $ret
} }
(( $+functions[_vboxmanage_bandwidthctl_add] )) ||
_vboxmanage_bandwidthctl_add() {
_arguments \
'--limit=[Specifies the bandwidth limit for a bandwidth group]:limit' \
'--type=[Specifies the type of the bandwidth group]: :(disk network)'
}
(( $+functions[_vboxmanage_bandwidthctl_list] )) ||
_vboxmanage_bandwidthctl_list() {
_arguments \
'--machinereadable[Outputs the information about the bandwidth groups in name-value pairs]'
}
(( $+functions[_vboxmanage_bandwidthctl_set] )) ||
_vboxmanage_bandwidthctl_set() {
_arguments \
'--limit=[Specifies the bandwidth limit for a bandwidth group]:limit'
}
(( $+functions[_vboxmanage_mediumio] )) || (( $+functions[_vboxmanage_mediumio] )) ||
_vboxmanage_mediumio() { _vboxmanage_mediumio() {
local ret=1 local ret=1
@ -836,51 +825,46 @@ _vboxmanage_mediumio() {
case $state in case $state in
(arg) (arg)
local subcommand=$words[1] case $words[1] in
if (( $+functions[_vboxmanage_mediumio_${subcommand}] )); then (formatfat)
_vboxmanage_mediumio_${subcommand} && ret=0 _arguments \
fi '--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]' \
&& ret=0
;;
(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' \
&& ret=0
;;
(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' \
&& ret=0
;;
esac
;; ;;
esac esac
return $ret 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[_vboxmanage_usbfilter] )) || (( $+functions[_vboxmanage_usbfilter] )) ||
_vboxmanage_usbfilter() { _vboxmanage_usbfilter() {
local ret=1 local ret=1