Added new options for commands.

In version 5.2.14 of VirtualBox, new options for following commands has
been added. Adjusted completion accordingly.

- list (-s|--sorted)
- modifyvm (--cpiudset -> --cpuid-set, --cpuidremove -> --cpuid-remove,
  --audioin, --audioout)
- export (new file format choice: --opc10)
- startvm (-E|--putenv)
- conrolvm (keyboardputstring, keyboardputfile, audioin, audioout)
- storageattach (--passwordfile)
- modifymedium (--description)
This commit is contained in:
2018-09-08 16:36:01 +02:00
parent e90270e8ee
commit d027094e7c

View File

@@ -42,6 +42,18 @@ _VBoxManage() {
done done
} }
_is_any_item_used() {
local i
result=""
for i in $@; do
if [[ " ${COMP_WORDS[@]} " == *" $i "* ]]; then
result="ITIS"
break
fi
done
}
# Generate registered hard disk files. # Generate registered hard disk files.
# NOTE: This function may introduce some quirks, if there is a space or # NOTE: This function may introduce some quirks, if there is a space or
# other characters which usually are treated as IFS - like space. Pipe # other characters which usually are treated as IFS - like space. Pipe
@@ -629,7 +641,8 @@ _VBoxManage() {
vrdevideochannelquality webcam videocap videocapscreens vrdevideochannelquality webcam videocap videocapscreens
videocapfile videocapres videocaprate videocapfps videocapfile videocapres videocaprate videocapfps
videocapmaxtime videocapmaxsize addencpassword removeencpassword videocapmaxtime videocapmaxsize addencpassword removeencpassword
removeallencpasswords) removeallencpasswords keyboardputstring keyboardputfile audioin
audioout)
_find_item_name 2 _find_item_name 2
subcommand=${COMP_WORDS[$((index+1))]} subcommand=${COMP_WORDS[$((index+1))]}
@@ -659,7 +672,7 @@ _VBoxManage() {
COMPREPLY=( $(compgen -W "delete tcp COMPREPLY=( $(compgen -W "delete tcp
udp" -- ${cur}) ) udp" -- ${cur}) )
;; ;;
setlinkstate[1-8]) audioin|audioout|setlinkstate[1-8])
[[ ${prev} == "setlinkstate"* ]] && \ [[ ${prev} == "setlinkstate"* ]] && \
COMPREPLY=( $(compgen -W "on off" -- ${cur}) ) COMPREPLY=( $(compgen -W "on off" -- ${cur}) )
;; ;;
@@ -937,8 +950,9 @@ _VBoxManage() {
[[ " ${COMP_WORDS[@]} " != *" --legacy09 "* && [[ " ${COMP_WORDS[@]} " != *" --legacy09 "* &&
" ${COMP_WORDS[@]} " != *" --ovf09 "* && " ${COMP_WORDS[@]} " != *" --ovf09 "* &&
" ${COMP_WORDS[@]} " != *" --ovf10 "* && " ${COMP_WORDS[@]} " != *" --ovf10 "* &&
" ${COMP_WORDS[@]} " != *" --ovf20 "* ]] && " ${COMP_WORDS[@]} " != *" --ovf20 "* &&
items+=(--legacy09 --ovf09 --ovf10 --ovf20) " ${COMP_WORDS[@]} " != *" --opc20 "* ]] &&
items+=(--legacy09 --ovf09 --ovf10 --ovf20 --opc10)
[[ " ${COMP_WORDS[@]} " == *" --vsys "* ]] && [[ " ${COMP_WORDS[@]} " == *" --vsys "* ]] &&
items+=(--product --producturl --vendor --vendorurl items+=(--product --producturl --vendor --vendorurl
--version --description --eula --eulafile) --version --description --eula --eulafile)
@@ -1401,11 +1415,14 @@ _VBoxManage() {
_list_comp ${cur} _list_comp ${cur}
else else
case "${prev}" in case "${prev}" in
--sorted|-s)
COMPREPLY=( $(compgen -W "-l --long" -- ${cur}) )
;;
--long|-l) --long|-l)
COMPREPLY=() COMPREPLY=( $(compgen -W "-s --sorted" -- ${cur}) )
;; ;;
*) *)
COMPREPLY=( $(compgen -W "-l --long" -- ${cur}) ) COMPREPLY=( $(compgen -W "-l --long -s --sorted" -- ${cur}) )
;; ;;
esac esac
fi fi
@@ -1498,7 +1515,7 @@ _VBoxManage() {
*) *)
_find_item_name 2 _find_item_name 2
items=(--type --autoreset --property --compact --resize items=(--type --autoreset --property --compact --resize
--move) --move --description)
_get_excluded_items "${items[@]}" _get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
case "${prev}" in case "${prev}" in
@@ -1523,7 +1540,7 @@ _VBoxManage() {
items=(--name --groups --description --ostype --iconfile --memory items=(--name --groups --description --ostype --iconfile --memory
--pagefusion --vram --acpi --pciattach --pcidetach --ioapic --hpet --pagefusion --vram --acpi --pciattach --pcidetach --ioapic --hpet
--triplefaultreset --hwvirtex --nestedpaging --largepages --vtxvpid --triplefaultreset --hwvirtex --nestedpaging --largepages --vtxvpid
--vtxux --pae --longmode --cpuidset --cpuidremove --vtxux --pae --longmode --cpuid-set --cpuid-remove
--cpuidremoveall --hardwareuuid --cpus --cpuhotplug --plugcpu --cpuidremoveall --hardwareuuid --cpus --cpuhotplug --plugcpu
--unplugcpu --cpuexecutioncap --rtcuseutc --graphicscontroller --unplugcpu --cpuexecutioncap --rtcuseutc --graphicscontroller
--monitorcount --accelerate3d --accelerate2dvideo --firmware --monitorcount --accelerate3d --accelerate2dvideo --firmware
@@ -1593,7 +1610,7 @@ _VBoxManage() {
--cpuid-portability-level --paravirtprovider --audiocodec --usbxhci --cpuid-portability-level --paravirtprovider --audiocodec --usbxhci
--usbrename --apic --x2apic --paravirtdebug --cpu-profile --usbrename --apic --x2apic --paravirtdebug --cpu-profile
--biosapic --videocapopts --ibpb-on-vm-entry --ibpb-on-vm-exit --biosapic --videocapopts --ibpb-on-vm-entry --ibpb-on-vm-exit
--spec-ctrl) --spec-ctrl --audioin --audioout)
if [[ ${prev} == ${cmd} ]]; then if [[ ${prev} == ${cmd} ]]; then
_vms_comp vms _vms_comp vms
@@ -1633,7 +1650,8 @@ _VBoxManage() {
--usbehci|--teleporter|--tracing-enabled|\ --usbehci|--teleporter|--tracing-enabled|\
--tracing-allow-vm-access|--usbcardreader|\ --tracing-allow-vm-access|--usbcardreader|\
--autostart-enabled|--videocap|--usbxhci|--apic|--x2apic|\ --autostart-enabled|--videocap|--usbxhci|--apic|--x2apic|\
--ibpb-on-vm-entry|--ibpb-on-vm-exit|--spec-ctrl) --ibpb-on-vm-entry|--ibpb-on-vm-exit|--spec-ctrl|--audioin|\
--audioout)
COMPREPLY=( $(compgen -W "on off" -- ${cur}) ) COMPREPLY=( $(compgen -W "on off" -- ${cur}) )
;; ;;
@@ -2013,7 +2031,13 @@ _VBoxManage() {
elif [[ "${prev}" == "--type" ]]; then elif [[ "${prev}" == "--type" ]]; then
COMPREPLY=( $(compgen -W "gui sdl headless separate" -- ${cur}) ) COMPREPLY=( $(compgen -W "gui sdl headless separate" -- ${cur}) )
else else
local items=(--type) local items=(--putenv -E)
_is_any_item_used "${items[@]}"
if [[ "${result}" == "ITIS" ]]; then
local items=(--type)
else
local items=(--type -E --putenv)
fi
_get_excluded_items "${items[@]}" _get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
fi fi
@@ -2028,7 +2052,7 @@ _VBoxManage() {
--comment --setuuid --setparentuuid --passthrough --tempeject --comment --setuuid --setparentuuid --passthrough --tempeject
--nonrotational --discard --hotpluggable --bandwidthgroup --nonrotational --discard --hotpluggable --bandwidthgroup
--forceunmount --server --target --tport --lun --encodedlun --forceunmount --server --target --tport --lun --encodedlun
--username --password --initiator --intnet) --username --password --initiator --intnet --passwordfile)
_get_excluded_items "${items[@]}" _get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) COMPREPLY=( $(compgen -W "$result" -- ${cur}) )