Updated list, closemedium, controlvm, modifyvm, natnetwork

and several other commands.
This commit is contained in:
2016-07-05 19:55:14 +02:00
parent c6e71c51d9
commit fcc43508e6
2 changed files with 56 additions and 19 deletions

View File

@@ -6,7 +6,7 @@ script. However, in some point of time I've decided to rewrite it almost from
scratch. scratch.
Current version of script was written and tested against VBoxManage in version Current version of script was written and tested against VBoxManage in version
4.3.32, and supports all commands (in some extent ;)). 5.0.18, and supports all commands (in some extent ;)).
Unlike other attempts, I've tried to make the script context aware. See the Unlike other attempts, I've tried to make the script context aware. See the
simple session with the VBoxManage command below, to have an idea how it works: simple session with the VBoxManage command below, to have an idea how it works:

View File

@@ -533,6 +533,9 @@ _VBoxManage() {
closemedium) closemedium)
if [[ ${prev} == ${cmd} ]]; then if [[ ${prev} == ${cmd} ]]; then
COMPREPLY=( $(compgen -W "disk dvd floppy" -- ${cur}) ) COMPREPLY=( $(compgen -W "disk dvd floppy" -- ${cur}) )
_hdd_comp
_dvds_comp
_floppy_comp
else else
case "${prev}" in case "${prev}" in
disk) disk)
@@ -557,7 +560,7 @@ _VBoxManage() {
_vms_comp runningvms _vms_comp runningvms
else else
local items=(acpipowerbutton acpisleepbutton clipboard local items=(acpipowerbutton acpisleepbutton clipboard
cpuexecutioncap draganddrop guestmemoryballoon cpuexecutioncap draganddrop guestmemoryballoon usbattach
keyboardputscancode natpf1 nic1 nicpromisc1 nicproperty1 keyboardputscancode natpf1 nic1 nicpromisc1 nicproperty1
nictrace1 nictracefile1 natpf2 nic2 nicpromisc2 nicproperty2 nictrace1 nictracefile1 natpf2 nic2 nicpromisc2 nicproperty2
nictrace2 nictracefile2 natpf3 nic3 nicpromisc3 nicproperty3 nictrace2 nictracefile2 natpf3 nic3 nicpromisc3 nicproperty3
@@ -570,8 +573,12 @@ _VBoxManage() {
screenshotpng setcredentials setlinkstate1 setlinkstate2 screenshotpng setcredentials setlinkstate1 setlinkstate2
setlinkstate3 setlinkstate4 setlinkstate5 setlinkstate6 setlinkstate3 setlinkstate4 setlinkstate5 setlinkstate6
setlinkstate7 setlinkstate8 setvideomodehint teleport unplugcpu setlinkstate7 setlinkstate8 setvideomodehint teleport unplugcpu
usbattach usbdetach vcpenabled vcpscreens vrde vrdeport usbattach usbdetach vrde vrdeport vrdeproperty
vrdeproperty vrdevideochannelquality webcam) vrdevideochannelquality webcam videocap videocapscreens
videocapfile videocapres videocaprate videocapfps
videocapmaxtime videocapmaxsize addencpassword removeencpassword
removeallencpasswords)
_find_item_name 2 _find_item_name 2
subcommand=${COMP_WORDS[$((index+1))]} subcommand=${COMP_WORDS[$((index+1))]}
@@ -615,13 +622,13 @@ _VBoxManage() {
COMPREPLY=( $(compgen -W "disabled COMPREPLY=( $(compgen -W "disabled
hosttoguest" -- ${cur}) ) hosttoguest" -- ${cur}) )
;; ;;
vrde|vcpenabled) vrde|videocap)
[[ ${prev} == "vrde" || [[ ${prev} == "vrde" ||
${prev} == "vcpenabled" ]] && \ ${prev} == "videocap" ]] && \
COMPREPLY=( $(compgen -W "on off" -- ${cur}) ) COMPREPLY=( $(compgen -W "on off" -- ${cur}) )
;; ;;
vcpscreens) videocapscreens)
[[ ${prev} == "vcpscreens" ]] && \ [[ ${prev} == "videocapscreens" ]] && \
COMPREPLY=( $(compgen -W "all none" -- ${cur}) ) COMPREPLY=( $(compgen -W "all none" -- ${cur}) )
;; ;;
setcredentials) setcredentials)
@@ -644,6 +651,22 @@ _VBoxManage() {
[[ ${prev} == "attach" ]] && \ [[ ${prev} == "attach" ]] && \
_webcam_avail_comp _webcam_avail_comp
;; ;;
usbattach)
tmp=(--capturefile)
_get_excluded_items "${tmp[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
;;
--removeonsuspend)
COMPREPLY=( $(compgen -W "yes no" -- ${cur}) )
;;
addencpassword)
tmp=(--host --port --maxdowntime --passwordfile
--password)
_get_excluded_items "${tmp[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
;;
esac esac
else else
[[ ${#COMPREPLY[@]} -eq 0 ]] && \ [[ ${#COMPREPLY[@]} -eq 0 ]] && \
@@ -1123,8 +1146,8 @@ _VBoxManage() {
else else
case "${prev}" in case "${prev}" in
--options) --options)
COMPREPLY=( $(compgen -W "keepallmacs keepnatmacs" \ COMPREPLY=( $(compgen -W "keepallmacs keepnatmacs
-- ${cur}) ) importtovdi" -- ${cur}) )
;; ;;
esac esac
[[ " ${COMP_WORDS[@]} " != *" --dry-run"* && [[ " ${COMP_WORDS[@]} " != *" --dry-run"* &&
@@ -1230,7 +1253,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 --synthcpu --cpuidset --cpuidremove --vtxux --pae --longmode --cpuidset --cpuidremove
--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
@@ -1294,9 +1317,11 @@ _VBoxManage() {
--teleporter --teleporterport --teleporteraddress --teleporter --teleporterport --teleporteraddress
--teleporterpassword --teleporterpasswordfile --tracing-enabled --teleporterpassword --teleporterpasswordfile --tracing-enabled
--tracing-config --tracing-allow-vm-access --usbcardreader --tracing-config --tracing-allow-vm-access --usbcardreader
--autostart-enabled --autostart-delay --vcpenabled --vcpscreens --autostart-enabled --autostart-delay --videocap --videocapscreens
--vcpfile --vcpwidth --vcpheight --vcprate --vcpfps --videocapfile --videocapres --vcpwidth --videocaprate --videocapfps
--defaultfrontend) --videocapmaxtime --videocapmaxsize --videocapopts --defaultfrontend
--cpuid-portability-level --paravirtprovider --audiocodec --usbxhci
--usbrename)
if [[ ${prev} == ${cmd} ]]; then if [[ ${prev} == ${cmd} ]]; then
_vms_comp vms _vms_comp vms
@@ -1314,7 +1339,7 @@ _VBoxManage() {
;; ;;
--pagefusion|--acpi|--ioapic|--hpet|--triplefaultreset|\ --pagefusion|--acpi|--ioapic|--hpet|--triplefaultreset|\
--hwvirtex|--nestedpaging|--largepages|--vtxvpid|--vtxux|\ --hwvirtex|--nestedpaging|--largepages|--vtxvpid|--vtxux|\
--pae|--longmode|--synthcpu|--cpuhotplug|--rtcuseutc|\ --pae|--longmode|--cpuhotplug|--rtcuseutc|\
--accelerate3d|--accelerate2dvideo|--bioslogofadein|\ --accelerate3d|--accelerate2dvideo|--bioslogofadein|\
--bioslogofadeout|--biospxedebug|--cableconnected1|\ --bioslogofadeout|--biospxedebug|--cableconnected1|\
--cableconnected2|--cableconnected3|--cableconnected4|\ --cableconnected2|--cableconnected3|--cableconnected4|\
@@ -1333,7 +1358,7 @@ _VBoxManage() {
--vrdemulticon|--vrdereusecon|--vrdevideochannel|--usb|\ --vrdemulticon|--vrdereusecon|--vrdevideochannel|--usb|\
--usbehci|--teleporter|--tracing-enabled|\ --usbehci|--teleporter|--tracing-enabled|\
--tracing-allow-vm-access|--usbcardreader|\ --tracing-allow-vm-access|--usbcardreader|\
--autostart-enabled|--vcpenabled) --autostart-enabled|--videocap|--usbxhci)
COMPREPLY=( $(compgen -W "on off" -- ${cur}) ) COMPREPLY=( $(compgen -W "on off" -- ${cur}) )
;; ;;
--graphicscontroller) --graphicscontroller)
@@ -1420,7 +1445,7 @@ _VBoxManage() {
;; ;;
--uartmode[1-2]) --uartmode[1-2])
COMPREPLY+=( $(compgen -W "disconnected server client COMPREPLY+=( $(compgen -W "disconnected server client
file" -- ${cur}) ) tcpserver tcpclient file" -- ${cur}) )
;; ;;
--audio) --audio)
COMPREPLY+=( $(compgen -W "none null oss alsa pulse" \ COMPREPLY+=( $(compgen -W "none null oss alsa pulse" \
@@ -1431,6 +1456,11 @@ _VBoxManage() {
COMPREPLY+=( $(compgen -W "ac97 hda sb16" -- ${cur}) ) COMPREPLY+=( $(compgen -W "ac97 hda sb16" -- ${cur}) )
;; ;;
--audiocodec)
COMPREPLY+=( $(compgen -W "stac9700 ad1980 stac9221
sb16" -- ${cur}) )
;;
--clipboard) --clipboard)
COMPREPLY+=( $(compgen -W "disabled hosttoguest COMPREPLY+=( $(compgen -W "disabled hosttoguest
guesttohost bidirectional" -- ${cur}) ) guesttohost bidirectional" -- ${cur}) )
@@ -1448,6 +1478,13 @@ _VBoxManage() {
COMPREPLY+=( $(compgen -W "null external guest" \ COMPREPLY+=( $(compgen -W "null external guest" \
-- ${cur}) ) -- ${cur}) )
;; ;;
--paravirtprovider)
COMPREPLY=( $(compgen -W "none default legacy minimal
hyperv kvm" -- ${cur}) )
;;
--cpuid-portability-level)
COMPREPLY=( $(compgen -W "0 1 2 3" -- ${cur}) )
;;
esac esac
fi fi
;; ;;
@@ -1599,7 +1636,7 @@ _VBoxManage() {
if [[ " ${items[@]} " == *" $subcommand "* ]]; then if [[ " ${items[@]} " == *" $subcommand "* ]]; then
case "${subcommand}" in case "${subcommand}" in
take) take)
items=(--description --live) items=(--description --live --uniquename)
_get_excluded_items "${items[@]}" _get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
;; ;;
@@ -1636,7 +1673,7 @@ _VBoxManage() {
if [[ ${prev} == ${cmd} ]]; then if [[ ${prev} == ${cmd} ]]; then
_vms_comp vms 1 _vms_comp vms 1
elif [[ "${prev}" == "--type" ]]; then elif [[ "${prev}" == "--type" ]]; then
COMPREPLY=( $(compgen -W "gui sdl headless" -- ${cur}) ) COMPREPLY=( $(compgen -W "gui sdl headless separate" -- ${cur}) )
else else
local items=(--type) local items=(--type)
_get_excluded_items "${items[@]}" _get_excluded_items "${items[@]}"