5 Commits

Author SHA1 Message Date
35bce20ef5 Bump to 6.1.0 2019-12-25 12:24:22 +01:00
c8301459df Command extapck will be available on topmost completion again. 2019-12-22 19:06:05 +01:00
ab0cc7aea4 Fixes for modifyvm options completion. 2019-12-22 19:03:09 +01:00
f73e80c7ad Fixed list command 2019-12-22 19:03:09 +01:00
10900543fa Bump to version 6.0.12.
Changed videocap to recording in modifyvm and controlvm, changed from
usb to usbohci in modifyvm command, added new movevm and mediumio
commands and cloud related options.
2019-12-22 19:02:50 +01:00
2 changed files with 459 additions and 92 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
5.2.32, and supports all commands (in some extent ;)). 6.1.0, and should contain all commands and their options.
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

@@ -4,7 +4,7 @@
# URL: https://bitbucket.org/gryf/vboxmanage-bash-completion # URL: https://bitbucket.org/gryf/vboxmanage-bash-completion
# URL: https://github.com/gryf/vboxmanage-bash-completion # URL: https://github.com/gryf/vboxmanage-bash-completion
# License: 3-clause BSD-style license (see LICENSE file) # License: 3-clause BSD-style license (see LICENSE file)
# Version: 5.2.32 # Version: 6.1.0
_VBoxManage() { _VBoxManage() {
local cur prev opts cmd subcommand tmp items name index result local cur prev opts cmd subcommand tmp items name index result
@@ -323,14 +323,10 @@ _VBoxManage() {
_list_comp() { _list_comp() {
local list local list
list=$(VBoxManage list | \ list=$(VBoxManage list | sed -e '1,2d' \
grep '|' | \ -e 's/VBoxManage list //' \
sed 's/\[.*\]//g'| \ -e 's/[\[\]\|]/ /g' \
sed 's/VBoxManage list//' | \ -e 's/|/ /g'|xargs echo)
tr "\\n" " " | \
sed 's/$/\n/' | \
sed 's/\s\+//g' | \
sed 's/|/ /g')
COMPREPLY=( $(compgen -W "$list" -- ${cur}) ) COMPREPLY=( $(compgen -W "$list" -- ${cur}) )
} }
@@ -436,6 +432,42 @@ _VBoxManage() {
esac esac
} }
_cloudproviders_comp() {
local providers
local item
providers=$(VBoxManage list cloudproviders | \
grep "Short Name:" | \
sed 's/Short Name:\s\+//' | \
sed 's/\s/\\ /g' | \
tr '\n' '|' | \
sed 's/|$//')
IFS='|' read -ra providers <<< "$providers"
for item in "${providers[@]}"
do
[[ ${item^^} == ${cur^^}* ]] && COMPREPLY+=("$item")
done
}
_cloudprofiles_comp() {
local profiles
local item
profiles=$(VBoxManage list cloudprofiles | \
grep "Name:" | \
sed 's/Name:\s\+//' | \
sed 's/\s/\\ /g' | \
tr '\n' '|' | \
sed 's/|$//')
IFS='|' read -ra profiles <<< "$profiles"
for item in "${profiles[@]}"
do
[[ ${item^^} == ${cur^^}* ]] && COMPREPLY+=("$item")
done
}
COMP_WORDBREAKS=${COMP_WORDBREAKS//|/} # remove pipe from comp word breaks COMP_WORDBREAKS=${COMP_WORDBREAKS//|/} # remove pipe from comp word breaks
COMPREPLY=() COMPREPLY=()
@@ -456,9 +488,10 @@ _VBoxManage() {
sort | \ sort | \
uniq) uniq)
# add debugvm command manually, since it's described differently in # Add some commands manually, since they are listed differently in
# vboxmanage help # vboxmanage help.
opts="${opts} debugvm unattended" opts="${opts} mediumio debugvm unattended extpack clonevm snapshot
dhcpserver cloudprofile cloud"
if [[ ${cur} == "-q" || ${COMP_CWORD} -eq 1 ]] ; then if [[ ${cur} == "-q" || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
@@ -569,7 +602,7 @@ _VBoxManage() {
else else
_find_item_name 2 _find_item_name 2
items=(--snapshot --mode --options --name --groups --basefolder items=(--snapshot --mode --options --name --groups --basefolder
--uuid --register) --uuid --register --snapshot)
_get_excluded_items "${items[@]}" _get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
case "${prev}" in case "${prev}" in
@@ -583,7 +616,7 @@ _VBoxManage() {
;; ;;
--options) --options)
COMPREPLY=( $(compgen -W "link keepallmacs keepnatmacs COMPREPLY=( $(compgen -W "link keepallmacs keepnatmacs
keepdisknames" -- ${cur}) ) keepdisknames keephwuuids" -- ${cur}) )
;; ;;
--groups) --groups)
COMPREPLY=() COMPREPLY=()
@@ -622,6 +655,125 @@ _VBoxManage() {
fi fi
;; ;;
cloudprofile)
if [[ " ${COMP_WORDS[@]} " != *" --provider"* ||
" ${COMP_WORDS[@]} " != *" --profile"* ]]; then
items=(--provider --profile)
else
[[ " ${COMP_WORDS[@]} " != *" add"* &&
" ${COMP_WORDS[@]} " != *" update"* &&
" ${COMP_WORDS[@]} " != *" delete"* &&
" ${COMP_WORDS[@]} " != *" show"* ]] &&
items=(add update delete show)
fi
_get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
case "${prev}" in
--provider)
COMPREPLY=()
_cloudproviders_comp
;;
--profile)
COMPREPLY=()
_cloudprofiles_comp
;;
esac
if [[ " ${COMP_WORDS[@]} " == *" add"* ||
" ${COMP_WORDS[@]} " == *" update"* ]]; then
COMPREPLY=( $(compgen -W "--clouduser --fingerprint --keyfile
--passphrase --tenancy --compartment" -- ${cur}) )
fi
;;
cloud)
if [[ " ${COMP_WORDS[@]} " != *" --provider"* ||
" ${COMP_WORDS[@]} " != *" --profile"* ]]; then
items=(--provider --profile)
else
[[ " ${COMP_WORDS[@]} " != *" list"* &&
" ${COMP_WORDS[@]} " != *" instance"* &&
" ${COMP_WORDS[@]} " != *" image"* ]] &&
items=(list instance image)
fi
_get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
case "${prev}" in
--provider)
COMPREPLY=()
_cloudproviders_comp
;;
--profile)
COMPREPLY=()
_cloudprofiles_comp
;;
list)
COMPREPLY=( $(compgen -W "instances images" -- ${cur}) )
;;
instance)
COMPREPLY=( $(compgen -W "create info terminate start
pause" -- ${cur}) )
;;
image)
COMPREPLY=( $(compgen -W "create info delete import
export" -- ${cur}) )
;;
esac
if [[ " ${COMP_WORDS[@]} " == *" list images"* ]]; then
items=(--state --compartment-id)
_get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
fi
if [[ " ${COMP_WORDS[@]} " == *" instance create"* ]]; then
items=(--domain-name --display-name --shape --subnet --publicip
--boot-disk-size --privateip --public-ssh-key --launch-mode)
[[ " ${COMP_WORDS[@]} " != *" --image-id"* &&
" ${COMP_WORDS[@]} " != *" --boot-volume-id"* ]] &&
items+=(--image-id --boot-volume-id)
_get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
case "${prev}" in
--publicip)
COMPREPLY=( $(compgen -W "true false" -- ${cur}) )
;;
--launch-mode)
COMPREPLY=( $(compgen -W "NATIVE EMULATED
PARAVIRTUALIZED" -- ${cur}) )
;;
esac
fi
if [[ " ${COMP_WORDS[@]} " == *" instance info"* ||
" ${COMP_WORDS[@]} " == *" instance terminate"* ||
" ${COMP_WORDS[@]} " == *" instance start"* ||
" ${COMP_WORDS[@]} " == *" instance pause"* ]]; then
COMPREPLY=( $(compgen -W "--id" -- ${cur}) )
fi
if [[ " ${COMP_WORDS[@]} " == *" image create"* ]]; then
items=(--display-name --bucket-name --object-name --instance-id)
_get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
fi
if [[ " ${COMP_WORDS[@]} " == *" image info"* ||
" ${COMP_WORDS[@]} " == *" image delete"* ]]; then
COMPREPLY=( $(compgen -W "--id" -- ${cur}) )
fi
if [[ " ${COMP_WORDS[@]} " == *" image import"* ]]; then
COMPREPLY=( $(compgen -W "--id --bucket-name
--object-name" -- ${cur}) )
fi
if [[ " ${COMP_WORDS[@]} " == *" image export"* ]]; then
COMPREPLY=( $(compgen -W "--id --display-name --bucket-name
--object-name" -- ${cur}) )
fi
;;
controlvm) controlvm)
if [[ ${prev} == ${cmd} ]]; then if [[ ${prev} == ${cmd} ]]; then
_vms_comp runningvms _vms_comp runningvms
@@ -641,18 +793,17 @@ _VBoxManage() {
setlinkstate3 setlinkstate4 setlinkstate5 setlinkstate6 setlinkstate3 setlinkstate4 setlinkstate5 setlinkstate6
setlinkstate7 setlinkstate8 setvideomodehint teleport unplugcpu setlinkstate7 setlinkstate8 setvideomodehint teleport unplugcpu
usbattach usbdetach vrde vrdeport vrdeproperty usbattach usbdetach vrde vrdeport vrdeproperty
vrdevideochannelquality webcam videocap videocapscreens vrdevideochannelquality webcam recording addencpassword
videocapfile videocapres videocaprate videocapfps removeencpassword removeallencpasswords keyboardputstring
videocapmaxtime videocapmaxsize addencpassword removeencpassword keyboardputfile audioin audioout setscreenlayout changeuartmode1
removeallencpasswords keyboardputstring keyboardputfile audioin changeuartmode2 vm-process-priority)
audioout)
_find_item_name 2 _find_item_name 2
subcommand=${COMP_WORDS[$((index+1))]} subcommand=${COMP_WORDS[$((index+1))]}
if [[ " ${items[@]} " == *" $subcommand "* ]]; then if [[ " ${items[@]} " == *" $subcommand "* ]]; then
case "${subcommand}" in case "${subcommand}" in
videocapfile|keyboardputfile|nictracefile[1-8]) keyboardputfile|nictracefile[1-8])
[[ ${prev} == "nictracefile"* ]] && \ [[ ${prev} == "nictracefile"* ]] && \
COMPREPLY=( $(compgen -f -- ${cur}) ) COMPREPLY=( $(compgen -f -- ${cur}) )
;; ;;
@@ -689,11 +840,25 @@ _VBoxManage() {
COMPREPLY=( $(compgen -W "disabled hosttoguest COMPREPLY=( $(compgen -W "disabled hosttoguest
guesttohost bidirectional" -- ${cur}) ) guesttohost bidirectional" -- ${cur}) )
;; ;;
vrde|videocap) vrde)
[[ ${prev} == "vrde" || [[ ${prev} == "vrde" ]] && \
${prev} == "videocap" ]] && \
COMPREPLY=( $(compgen -W "on off" -- ${cur}) ) COMPREPLY=( $(compgen -W "on off" -- ${cur}) )
;; ;;
recording)
[[ ${prev} == "recording" ]] && \
COMPREPLY=( $(compgen -W "on off screens
filename videores videorate videofps maxtime
maxfilesize" -- ${cur}) )
case "${prev}" in
screens)
COMPREPLY=( $(compgen -W "all none
<screen>" -- ${cur}) )
;;
filename)
COMPREPLY=( $(compgen -f -- ${cur}) )
;;
esac
;;
videocapscreens) videocapscreens)
[[ ${prev} == "videocapscreens" ]] && \ [[ ${prev} == "videocapscreens" ]] && \
COMPREPLY=( $(compgen -W "all none" -- ${cur}) ) COMPREPLY=( $(compgen -W "all none" -- ${cur}) )
@@ -732,6 +897,17 @@ _VBoxManage() {
_get_excluded_items "${tmp[@]}" _get_excluded_items "${tmp[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
;; ;;
changeuartmode[1-2])
tmp=(disconnected server client tcpserver tcpclient
file "<devicename>")
_get_excluded_items "${tmp[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
;;
vm-process-priority)
COMPREPLY=( $(compgen -W "default flat low normal
high" -- ${cur}) )
;;
esac esac
elif [[ ${prev} == "--passwordfile" || ${prev} == "--capturefile" ]]; then elif [[ ${prev} == "--passwordfile" || ${prev} == "--capturefile" ]]; then
COMPREPLY=( $(compgen -f -- ${cur}) ) COMPREPLY=( $(compgen -f -- ${cur}) )
@@ -792,7 +968,7 @@ _VBoxManage() {
;; ;;
--variant) --variant)
COMPREPLY=( $(compgen -W "Standard Fixed Split2G COMPREPLY=( $(compgen -W "Standard Fixed Split2G
Stream ESX" -- ${cur}) ) Stream ESX Formatted" -- ${cur}) )
;; ;;
esac esac
;; ;;
@@ -801,7 +977,8 @@ _VBoxManage() {
;; ;;
createvm) createvm)
items=(--name --groups --ostype --register --basefolder --uuid) items=(--name --groups --ostype --register --basefolder --uuid
--default)
if [[ ${prev} == ${cmd} ]]; then if [[ ${prev} == ${cmd} ]]; then
COMPREPLY=( $(compgen -W "${items[*]}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${items[*]}" -- ${cur}) )
else else
@@ -882,39 +1059,143 @@ _VBoxManage() {
;; ;;
dhcpserver) dhcpserver)
items=(add modify remove) items=(add modify remove restart findlease)
subcommand=${COMP_WORDS[2]} subcommand=${COMP_WORDS[2]}
if [[ " ${items[@]} " == *" $subcommand "* ]]; then if [[ " ${items[@]} " == *" $subcommand "* ]]; then
case "${subcommand}" in case "${subcommand}" in
add|modify) add)
items=(--ip --netmask --lowerip --upperip) items=(--server-ip --netmask --lower-ip --upper-ip)
[[ " ${COMP_WORDS[@]} " != *" --interface"* &&
[[ " ${COMP_WORDS[@]} " != *" --ifname"* && " ${COMP_WORDS[@]} " != *" --network"* ]] &&
" ${COMP_WORDS[@]} " != *" --netname"* ]] && items+=(--network --interface)
items+=(--netname --ifname)
[[ " ${COMP_WORDS[@]} " != *" --enable"* && [[ " ${COMP_WORDS[@]} " != *" --enable"* &&
" ${COMP_WORDS[@]} " != *" --disable"* ]] && " ${COMP_WORDS[@]} " != *" --disable"* ]] &&
items+=(--enable --disable) items+=(--enable --disable)
[[ " ${COMP_WORDS[@]} " == *" --options"* ]] &&
items+=(--vm --nic --id --value --remove)
[[ " ${COMP_WORDS[@]} " != *" --global"* &&
" ${COMP_WORDS[@]} " != *" --group"* &&
" ${COMP_WORDS[@]} " != *" --vm"* &&
" ${COMP_WORDS[@]} " != *" --mac-address"* ]] &&
items+=(--global --group --vm --mac-address)
[[ " ${COMP_WORDS[@]} " == *" --global"* ]] &&
items+=(--set-opt --set-opt-hex --force-opt
--supress-opt --min-lease-time --default-lease-time
--max-lease-time)
[[ " ${COMP_WORDS[@]} " == *" --group"* ]] &&
items+=(--set-opt --set-opt-hex --force-opt
--supress-opt --incl-mac --excl-mac --incl-mac-wild
--excl-mac-wild --incl-vendor --excl-vendor
--incl-vendor-wild --excl-vendor-wild --incl-user
--excl-user --incl-user-wild --excl-user-wild
--min-lease-time --default-lease-time
--max-lease-time)
[[ " ${COMP_WORDS[@]} " == *" --vm"* ]] &&
items+=(--nic --set-opt --set-opt-hex --force-opt
--supress-opt --min-lease-time --default-lease-time
--max-lease-time --fixed-address)
[[ " ${COMP_WORDS[@]} " == *" --mac-address"* ]] &&
items+=(--set-opt --set-opt-hex --force-opt
--supress-opt --min-lease-time --default-lease-time
--max-lease-time --fixed-address)
_get_excluded_items "${items[@]}" _get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
;; ;;
remove) modify)
items=(--server-ip --netmask --lower-ip --upper-ip)
[[ " ${COMP_WORDS[@]} " != *" --interface"* &&
" ${COMP_WORDS[@]} " != *" --network"* ]] &&
items+=(--network --interface)
[[ " ${COMP_WORDS[@]} " != *" --enable"* &&
" ${COMP_WORDS[@]} " != *" --disable"* ]] &&
items+=(--enable --disable)
[[ " ${COMP_WORDS[@]} " == *" --options"* ]] &&
items+=(--vm --nic --id --value --remove)
[[ " ${COMP_WORDS[@]} " != *" --global"* &&
" ${COMP_WORDS[@]} " != *" --group"* &&
" ${COMP_WORDS[@]} " != *" --vm"* &&
" ${COMP_WORDS[@]} " != *" --mac-address"* ]] &&
items+=(--global --group --vm --mac-address)
[[ " ${COMP_WORDS[@]} " == *" --global"* ]] &&
items+=(--del-opt --set-opt --set-opt-hex --force-opt
--unforce-opt --supress-opt --unsupress-opt
--min-lease-time --default-lease-time
--max-lease-time --remove-config)
[[ " ${COMP_WORDS[@]} " == *" --group"* ]] &&
items+=(--set-opt-hex --force-opt --unforce-opt
--supress-opt --unsupress-opt --del-mac --incl-mac
--excl-mac --del-mac-wild --incl-mac-wild
--excl-mac-wild --del-vendor --incl-vendor
--excl-vendor --del-vendor-wild --incl-vendor-wild
--excl-vendor-wild --del-user --incl-user
--excl-user --del-user-wild --incl-user-wild
--excl-user-wild --zap-conditions --min-lease-time
--default-lease-time --max-lease-time
--remove-config)
[[ " ${COMP_WORDS[@]} " == *" --vm"* ]] &&
items+=(--del-opt --set-opt --set-opt-hex --force-opt
--unforce-opt --supress-opt --unsupress-opt
--min-lease-time --default-lease-time
--max-lease-time --fixed-address --remove-config)
[[ " ${COMP_WORDS[@]} " == *" --mac-address"* ]] &&
items+=(--set-opt --set-opt-hex --force-opt
--unforce-opt --supress-opt --unsupress-opt
--min-lease-time --default-lease-time
--max-lease-time --fixed-address --remove-config)
_get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
;;
remove|restart)
case "${prev}" in case "${prev}" in
--netname) --network)
COMPREPLY=() COMPREPLY=()
_dhcp_comp _dhcp_comp
;; ;;
--ifname) --interface)
COMPREPLY=() COMPREPLY=()
_hostonlyif_comp _hostonlyif_comp
;; ;;
esac esac
if [[ " ${COMP_WORDS[@]} " != *" --ifname"* && if [[ " ${COMP_WORDS[@]} " != *" --interface"* &&
" ${COMP_WORDS[@]} " != *" --netname"* ]]; then " ${COMP_WORDS[@]} " != *" --network"* ]]; then
items=(--netname --ifname) items=(--network --interface)
_get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
fi
;;
findlease)
items=(--mac-address)
case "${prev}" in
--network)
COMPREPLY=()
_dhcp_comp
;;
--interface)
COMPREPLY=()
_hostonlyif_comp
;;
esac
if [[ " ${COMP_WORDS[@]} " != *" --interface"* &&
" ${COMP_WORDS[@]} " != *" --network"* ]]; then
items+=(--network --interface)
_get_excluded_items "${items[@]}" _get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
fi fi
@@ -945,11 +1226,15 @@ _VBoxManage() {
;; ;;
"export") "export")
items=( --manifest --iso --options --vsys) items=( --manifest --iso --options --vsys --cloud )
if [[ ${prev} == ${cmd} ]]; then if [[ ${prev} == ${cmd} ]]; then
_vms_comp vms _vms_comp vms
elif [[ ${prev} == "--eulafile" ]]; then elif [[ ${prev} == "--eulafile" ]]; then
COMPREPLY=( $(compgen -f -- ${cur}) ) COMPREPLY=( $(compgen -f -- ${cur}) )
elif [[ ${prev} == "--cloudkeepobject" ||
${prev} == "--cloudlaunchinstance" ||
${prev} == "--cloudpublicip" ]]; then
COMPREPLY=( $(compgen -W "true false" -- ${cur}) )
else else
[[ " ${COMP_WORDS[@]} " != *" -o "* && [[ " ${COMP_WORDS[@]} " != *" -o "* &&
" ${COMP_WORDS[@]} " != *" --output "* ]] && " ${COMP_WORDS[@]} " != *" --output "* ]] &&
@@ -962,7 +1247,12 @@ _VBoxManage() {
items+=(--legacy09 --ovf09 --ovf10 --ovf20 --opc10) 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 --vmname)
[[ " ${COMP_WORDS[@]} " == *" --cloud"* ]] &&
items+=(--vmname --cloudprofile --cloudshape --clouddomain
--clouddisksize --cloudbucket --cloudocivcn --cloudocisubnet
--cloudkeepobject --cloudlaunchinstance --cloudpublicip
--cloudprivateip --cloudlaunchmode)
_get_excluded_items "${items[@]}" _get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
@@ -971,6 +1261,10 @@ _VBoxManage() {
COMPREPLY=( $(compgen -W "manifest iso nomacs COMPREPLY=( $(compgen -W "manifest iso nomacs
nomacsbutnat" -- ${cur}) ) nomacsbutnat" -- ${cur}) )
;; ;;
--cloudlaunchmode)
COMPREPLY=( $(compgen -W "EMULATED PARAVIRTUALIZED" \
-- ${cur}) )
;;
esac esac
[[ ${#COMPREPLY[@]} -eq 0 ]] && \ [[ ${#COMPREPLY[@]} -eq 0 ]] && \
COMPREPLY=( $(compgen -W "${items[*]}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${items[*]}" -- ${cur}) )
@@ -1075,8 +1369,8 @@ _VBoxManage() {
;; ;;
copyfrom|copyto) copyfrom|copyto)
items=(--dryrun --follow --target-directory items=(--follow --target-directory --username
--username --domain) --domain)
[[ " ${COMP_WORDS[@]} " != *" --recursive "* && [[ " ${COMP_WORDS[@]} " != *" --recursive "* &&
" ${COMP_WORDS[@]} " != *" -R "* ]] && " ${COMP_WORDS[@]} " != *" -R "* ]] &&
@@ -1398,7 +1692,8 @@ _VBoxManage() {
;; ;;
import) import)
items=(--options) items=(--options --dry-run -n --vmname --cloud --cloudprofile
--cloudinstanceid --cloudbucket)
if [[ "${prev}" == "import" ]]; then if [[ "${prev}" == "import" ]]; then
COMPREPLY=( $(compgen -o plusdirs -f -X '!@(*.ovf|*.ova)' \ COMPREPLY=( $(compgen -o plusdirs -f -X '!@(*.ovf|*.ova)' \
-- ${cur}) ) -- ${cur}) )
@@ -1438,6 +1733,31 @@ _VBoxManage() {
fi fi
;; ;;
mediumio)
if [[ ${prev} == ${cmd} ]]; then
_hdd_comp
_floppy_comp
_dvds_comp
else
case "${prev}" in
formatfat)
COMPREPLY=( $(compgen -W "--quick" -- ${cur}) )
;;
cat)
COMPREPLY=( $(compgen -W "--hex --offset --size
--output" -- ${cur}) )
;;
stream)
COMPREPLY=( $(compgen -W "--forma --variant
--output" -- ${cur}) )
;;
*)
COMPREPLY=( $(compgen -W "--password-file cat formatfat
stream" -- ${cur}) )
esac
fi
;;
mediumproperty) mediumproperty)
if [[ ${prev} == ${cmd} ]]; then if [[ ${prev} == ${cmd} ]]; then
COMPREPLY=( $(compgen -W "disk dvd floppy" -- ${cur}) ) COMPREPLY=( $(compgen -W "disk dvd floppy" -- ${cur}) )
@@ -1525,7 +1845,7 @@ _VBoxManage() {
*) *)
_find_item_name 2 _find_item_name 2
items=(--type --autoreset --property --compact --resize items=(--type --autoreset --property --compact --resize
--move --description) --move --description --setlocation)
_get_excluded_items "${items[@]}" _get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
case "${prev}" in case "${prev}" in
@@ -1540,6 +1860,9 @@ _VBoxManage() {
--move) --move)
COMPREPLY=( $(compgen -o dirnames -- ${cur}) ) COMPREPLY=( $(compgen -o dirnames -- ${cur}) )
;; ;;
--setlocation)
COMPREPLY=( $(compgen -f -- ${cur}) )
;;
esac esac
;; ;;
esac esac
@@ -1548,7 +1871,7 @@ _VBoxManage() {
modifyvm) modifyvm)
items=(--name --groups --description --ostype --iconfile --memory items=(--name --groups --description --ostype --iconfile --memory
--pagefusion --vram --acpi --pciattach --pcidetach --ioapic --hpet --pagefusion --vram --acpi --ioapic --hpet
--triplefaultreset --hwvirtex --nestedpaging --largepages --vtxvpid --triplefaultreset --hwvirtex --nestedpaging --largepages --vtxvpid
--vtxux --pae --longmode --cpuid-set --cpuid-remove --vtxux --pae --longmode --cpuid-set --cpuid-remove
--cpuidremoveall --hardwareuuid --cpus --cpuhotplug --plugcpu --cpuidremoveall --hardwareuuid --cpus --cpuhotplug --plugcpu
@@ -1607,21 +1930,23 @@ _VBoxManage() {
--macaddress3 --macaddress4 --macaddress5 --macaddress6 --macaddress3 --macaddress4 --macaddress5 --macaddress6
--macaddress7 --macaddress8 --mouse --keyboard --uart1 --uartmode1 --macaddress7 --macaddress8 --mouse --keyboard --uart1 --uartmode1
--uart2 --uartmode2 --lpt1 --lptmode1 --guestmemoryballoon --audio --uart2 --uartmode2 --lpt1 --lptmode1 --guestmemoryballoon --audio
--audiocontroller --clipboard --draganddrop --vrde --vrdeextpack --audiocontroller --clipboard-mode --draganddrop --vrde --vrdeextpack
--vrdeproperty --vrdeport --vrdeaddress --vrdeauthtype --vrdeproperty --vrdeport --vrdeaddress --vrdeauthtype
--vrdeauthlibrary --vrdemulticon --vrdereusecon --vrdevideochannel --vrdeauthlibrary --vrdemulticon --vrdereusecon --vrdevideochannel
--vrdevideochannelquality --usb --usbehci --snapshotfolder --vrdevideochannelquality --usbohci --usbehci --snapshotfolder
--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 --videocap --videocapscreens --autostart-enabled --autostart-delay --recording --recordingscreens
--videocapfile --videocapres --videocaprate --videocapfps --recordingfile --recordingvideores --recordingvideorate
--videocapmaxtime --videocapmaxsize --videocapopts --defaultfrontend --recordingvideofps --recordingmaxtime --recordingmaxsize
--cpuid-portability-level --paravirtprovider --audiocodec --usbxhci --recordingopts --defaultfrontend --cpuid-portability-level
--usbrename --apic --x2apic --paravirtdebug --cpu-profile --paravirtprovider --audiocodec --usbxhci --usbrename --apic
--biosapic --ibpb-on-vm-entry --ibpb-on-vm-exit --spec-ctrl --x2apic --paravirtdebug --cpu-profile --biosapic --ibpb-on-vm-entry
--audioin --audioout --l1d-flush-on-sched --ibpb-on-vm-exit --spec-ctrl --audioin --audioout
--l1d-flush-on-vm-entry --mds-clear-on-sched --mds-clear-on-vm-entry) --l1d-flush-on-sched --l1d-flush-on-vm-entry --mds-clear-on-sched
--mds-clear-on-vm-entry --nested-hw-virt --uarttype1 --uarttype2
--system-uuid-le --vm-process-priority)
if [[ ${prev} == ${cmd} ]]; then if [[ ${prev} == ${cmd} ]]; then
_vms_comp vms _vms_comp vms
@@ -1657,18 +1982,19 @@ _VBoxManage() {
--natdnshostresolver3|--natdnshostresolver4|\ --natdnshostresolver3|--natdnshostresolver4|\
--natdnshostresolver5|--natdnshostresolver6|\ --natdnshostresolver5|--natdnshostresolver6|\
--natdnshostresolver7|--natdnshostresolver8|--vrde|\ --natdnshostresolver7|--natdnshostresolver8|--vrde|\
--vrdemulticon|--vrdereusecon|--vrdevideochannel|--usb|\ --vrdemulticon|--vrdereusecon|--vrdevideochannel|--usbohci|\
--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|--recording|--usbxhci|--apic|--x2apic|\
--ibpb-on-vm-entry|--ibpb-on-vm-exit|--spec-ctrl|--audioin|\ --ibpb-on-vm-entry|--ibpb-on-vm-exit|--spec-ctrl|--audioin|\
--audioout|--l1d-flush-on-sched|--l1d-flush-on-vm-entry|\ --audioout|--l1d-flush-on-sched|--l1d-flush-on-vm-entry|\
--mds-clear-on-sched|--mds-clear-on-vm-entry) --mds-clear-on-sched|--mds-clear-on-vm-entry|\
--nested-hw-virt|--system-uuid-le)
COMPREPLY=( $(compgen -W "on off" -- ${cur}) ) COMPREPLY=( $(compgen -W "on off" -- ${cur}) )
;; ;;
--graphicscontroller) --graphicscontroller)
COMPREPLY=( $(compgen -W "none vboxvga vmsvga" \ COMPREPLY=( $(compgen -W "none vboxvga vmsvga vboxsvga" \
-- ${cur}) ) -- ${cur}) )
;; ;;
@@ -1697,8 +2023,8 @@ _VBoxManage() {
;; ;;
--nictype[1-8]) --nictype[1-8])
COMPREPLY=( $(compgen -W "Am79C970A Am79C973 82540EM COMPREPLY=( $(compgen -W "Am79C970A Am79C973 Am79C960
82543GC 82545EM virtio" -- ${cur}) ) 82540EM 82543GC 82545EM virtio" -- ${cur}) )
;; ;;
--nicpromisc[1-8]) --nicpromisc[1-8])
@@ -1743,66 +2069,71 @@ _VBoxManage() {
;; ;;
--natpf[1-8]) --natpf[1-8])
COMPREPLY+=( $(compgen -W "delete" -- ${cur}) ) COMPREPLY=( $(compgen -W "delete" -- ${cur}) )
;; ;;
--nataliasmode[1-8]) --nataliasmode[1-8])
COMPREPLY+=( $(compgen -W "default" -- ${cur}) ) COMPREPLY=( $(compgen -W "default" -- ${cur}) )
;; ;;
--macaddress[1-8]) --macaddress[1-8])
COMPREPLY+=( $(compgen -W "auto" -- ${cur}) ) COMPREPLY=( $(compgen -W "auto" -- ${cur}) )
;; ;;
--mouse) --mouse)
COMPREPLY+=( $(compgen -W "ps2 usb usbtablet COMPREPLY=( $(compgen -W "ps2 usb usbtablet
usbmultitouch" -- ${cur}) ) usbmultitouch" -- ${cur}) )
;; ;;
--keyboard) --keyboard)
COMPREPLY+=( $(compgen -W "ps2 usb" -- ${cur}) ) COMPREPLY=( $(compgen -W "ps2 usb" -- ${cur}) )
;; ;;
--uart[1-2]|--lpt[1-2]) --uart[1-2]|--lpt[1-2])
COMPREPLY+=( $(compgen -W "off" -- ${cur}) ) COMPREPLY=( $(compgen -W "off" -- ${cur}) )
;; ;;
--uartmode[1-2]) --uartmode[1-2])
COMPREPLY+=( $(compgen -W "disconnected server client COMPREPLY=( $(compgen -W "disconnected server client
tcpserver tcpclient file" -- ${cur}) ) tcpserver tcpclient file" -- ${cur}) )
;; ;;
--uarttype[1-2])
COMPREPLY=( $(compgen -W "16450 16550A
16750" -- ${cur}) )
;;
--audio) --audio)
COMPREPLY+=( $(compgen -W "none null oss alsa pulse" \ COMPREPLY=( $(compgen -W "none null oss alsa pulse" \
-- ${cur}) ) -- ${cur}) )
;; ;;
--audiocontroller) --audiocontroller)
COMPREPLY+=( $(compgen -W "ac97 hda sb16" -- ${cur}) ) COMPREPLY=( $(compgen -W "ac97 hda sb16" -- ${cur}) )
;; ;;
--audiocodec) --audiocodec)
COMPREPLY+=( $(compgen -W "stac9700 ad1980 stac9221 COMPREPLY=( $(compgen -W "stac9700 ad1980 stac9221
sb16" -- ${cur}) ) sb16" -- ${cur}) )
;; ;;
--clipboard) --clipboard-mode)
COMPREPLY+=( $(compgen -W "disabled hosttoguest COMPREPLY=( $(compgen -W "disabled hosttoguest
guesttohost bidirectional" -- ${cur}) ) guesttohost bidirectional" -- ${cur}) )
;; ;;
--draganddrop) --draganddrop)
COMPREPLY+=( $(compgen -W "disabled hosttoguest COMPREPLY=( $(compgen -W "disabled hosttoguest
guesttohost bidirectional" -- ${cur}) ) guesttohost bidirectional" -- ${cur}) )
;; ;;
--vrdeextpack|--vrdeauthlibrary|--snapshotfolder|\ --vrdeextpack|--vrdeauthlibrary|--snapshotfolder|\
--defaultfrontend) --defaultfrontend)
COMPREPLY+=( $(compgen -W "default" -- ${cur}) ) COMPREPLY=( $(compgen -W "default" -- ${cur}) )
;; ;;
--vrdeauthtype) --vrdeauthtype)
COMPREPLY+=( $(compgen -W "null external guest" \ COMPREPLY=( $(compgen -W "null external guest" \
-- ${cur}) ) -- ${cur}) )
;; ;;
@@ -1824,7 +2155,7 @@ _VBoxManage() {
COMPREPLY=( $(compgen -W "disabled apic x2apic" \ COMPREPLY=( $(compgen -W "disabled apic x2apic" \
-- ${cur}) ) -- ${cur}) )
;; ;;
--teleporterpasswordfile|--iconfile|--videocapfile) --teleporterpasswordfile|--iconfile|--recordingfile)
COMPREPLY=( $(compgen -f -- ${cur}) ) COMPREPLY=( $(compgen -f -- ${cur}) )
;; ;;
--nictracefile[1-8]) --nictracefile[1-8])
@@ -1833,6 +2164,30 @@ _VBoxManage() {
--nattftpfile[1-8]) --nattftpfile[1-8])
COMPREPLY=( $(compgen -f -- ${cur}) ) COMPREPLY=( $(compgen -f -- ${cur}) )
;; ;;
--vm-process-priority)
COMPREPLY=( $(compgen -W "default flat low normal high" \
-- ${cur}) )
;;
esac
fi
;;
movevm)
if [[ ${prev} == ${cmd} ]]; then
_vms_comp vms
else
_find_item_name 2
items=(--type --folder)
_get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
case "${prev}" in
--type)
COMPREPLY=( $(compgen -W "basic" -- ${cur}) )
_snapshot_comp
;;
--folder)
COMPREPLY=( $(compgen -f -- ${cur}) )
;;
esac esac
fi fi
;; ;;
@@ -1889,7 +2244,7 @@ _VBoxManage() {
setproperty) setproperty)
items=(machinefolder hwvirtexclusive vrdeauthlibrary items=(machinefolder hwvirtexclusive vrdeauthlibrary
websrvauthlibrary vrdeextpack autostartdbpath loghistorycount websrvauthlibrary vrdeextpack autostartdbpath loghistorycount
defaultfrontend logginglevel) defaultfrontend logginglevel proxymode proxyurl)
subcommand=${COMP_WORDS[2]} subcommand=${COMP_WORDS[2]}
if [[ "${prev}" == "${cmd}" ]]; then if [[ "${prev}" == "${cmd}" ]]; then
COMPREPLY=( $(compgen -W "${items[*]}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${items[*]}" -- ${cur}) )
@@ -1916,6 +2271,10 @@ _VBoxManage() {
defaultfrontend) defaultfrontend)
COMPREPLY=( $(compgen -W "null" -- ${cur}) ) COMPREPLY=( $(compgen -W "null" -- ${cur}) )
;; ;;
proxymode)
COMPREPLY=( $(compgen -W "system noproxy
manual" -- ${cur}) )
;;
esac esac
fi fi
;; ;;
@@ -2040,8 +2399,16 @@ _VBoxManage() {
;; ;;
esac esac
else else
case "$prev" in
--uniquename)
COMPREPLY=( $(compgen -W "Number Timestamp Space
Force" -- ${cur}) )
;;
*)
[[ ${#COMPREPLY[@]} -eq 0 ]] && \ [[ ${#COMPREPLY[@]} -eq 0 ]] && \
COMPREPLY=( $(compgen -W "${items[*]}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${items[*]}" \
-- ${cur}) )
esac
fi fi
fi fi
;; ;;