mirror of
https://github.com/gryf/vboxmanage-bash-completion.git
synced 2025-12-19 12:28:19 +01:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 35bce20ef5 | |||
| c8301459df | |||
| ab0cc7aea4 | |||
| f73e80c7ad | |||
| 10900543fa | |||
| 1be3e589d4 | |||
| 9c5b048c62 | |||
| 5fd18d7cec | |||
| 05af06f337 | |||
| cde78c8e4c | |||
|
|
197c46cd35 | ||
|
|
296be19560 |
@@ -6,7 +6,7 @@ script. However, in some point of time I've decided to rewrite it almost from
|
||||
scratch.
|
||||
|
||||
Current version of script was written and tested against VBoxManage in version
|
||||
5.2.22, 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
|
||||
simple session with the VBoxManage command below, to have an idea how it works:
|
||||
|
||||
559
VBoxManage
559
VBoxManage
@@ -4,7 +4,7 @@
|
||||
# URL: https://bitbucket.org/gryf/vboxmanage-bash-completion
|
||||
# URL: https://github.com/gryf/vboxmanage-bash-completion
|
||||
# License: 3-clause BSD-style license (see LICENSE file)
|
||||
# Version: 5.2.22
|
||||
# Version: 6.1.0
|
||||
|
||||
_VBoxManage() {
|
||||
local cur prev opts cmd subcommand tmp items name index result
|
||||
@@ -271,11 +271,14 @@ _VBoxManage() {
|
||||
snap=$(VBoxManage snapshot "${name//\\/}" \
|
||||
list | \
|
||||
grep UUID |
|
||||
awk -F ': ' '{print $2}' | \
|
||||
sed 's/ (.*//' | \
|
||||
tr '\n' '|' | \
|
||||
sed 's/|$//' | \
|
||||
sed 's/\s/\\ /g')
|
||||
awk -F ': *' -v ORS='|' '/UUID: / {
|
||||
n=$2; u=$3
|
||||
sub(/..UUID/, "", n)
|
||||
gsub(/ /, "\\ ", n);
|
||||
sub(/[)].*/, "", u)
|
||||
print n; print u
|
||||
}'
|
||||
)
|
||||
IFS='|' read -ra snap <<< "$snap"
|
||||
|
||||
for item in "${snap[@]}"
|
||||
@@ -320,14 +323,10 @@ _VBoxManage() {
|
||||
|
||||
_list_comp() {
|
||||
local list
|
||||
list=$(VBoxManage list | \
|
||||
grep '|' | \
|
||||
sed 's/\[.*\]//g'| \
|
||||
sed 's/VBoxManage list//' | \
|
||||
tr "\\n" " " | \
|
||||
sed 's/$/\n/' | \
|
||||
sed 's/\s\+//g' | \
|
||||
sed 's/|/ /g')
|
||||
list=$(VBoxManage list | sed -e '1,2d' \
|
||||
-e 's/VBoxManage list //' \
|
||||
-e 's/[\[\]\|]/ /g' \
|
||||
-e 's/|/ /g'|xargs echo)
|
||||
COMPREPLY=( $(compgen -W "$list" -- ${cur}) )
|
||||
}
|
||||
|
||||
@@ -433,6 +432,42 @@ _VBoxManage() {
|
||||
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
|
||||
COMPREPLY=()
|
||||
|
||||
@@ -453,9 +488,10 @@ _VBoxManage() {
|
||||
sort | \
|
||||
uniq)
|
||||
|
||||
# add debugvm command manually, since it's described differently in
|
||||
# vboxmanage help
|
||||
opts="${opts} debugvm unattended"
|
||||
# Add some commands manually, since they are listed differently in
|
||||
# vboxmanage help.
|
||||
opts="${opts} mediumio debugvm unattended extpack clonevm snapshot
|
||||
dhcpserver cloudprofile cloud"
|
||||
|
||||
if [[ ${cur} == "-q" || ${COMP_CWORD} -eq 1 ]] ; then
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
||||
@@ -566,7 +602,7 @@ _VBoxManage() {
|
||||
else
|
||||
_find_item_name 2
|
||||
items=(--snapshot --mode --options --name --groups --basefolder
|
||||
--uuid --register)
|
||||
--uuid --register --snapshot)
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
case "${prev}" in
|
||||
@@ -580,7 +616,7 @@ _VBoxManage() {
|
||||
;;
|
||||
--options)
|
||||
COMPREPLY=( $(compgen -W "link keepallmacs keepnatmacs
|
||||
keepdisknames" -- ${cur}) )
|
||||
keepdisknames keephwuuids" -- ${cur}) )
|
||||
;;
|
||||
--groups)
|
||||
COMPREPLY=()
|
||||
@@ -619,6 +655,125 @@ _VBoxManage() {
|
||||
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)
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
_vms_comp runningvms
|
||||
@@ -638,18 +793,17 @@ _VBoxManage() {
|
||||
setlinkstate3 setlinkstate4 setlinkstate5 setlinkstate6
|
||||
setlinkstate7 setlinkstate8 setvideomodehint teleport unplugcpu
|
||||
usbattach usbdetach vrde vrdeport vrdeproperty
|
||||
vrdevideochannelquality webcam videocap videocapscreens
|
||||
videocapfile videocapres videocaprate videocapfps
|
||||
videocapmaxtime videocapmaxsize addencpassword removeencpassword
|
||||
removeallencpasswords keyboardputstring keyboardputfile audioin
|
||||
audioout)
|
||||
vrdevideochannelquality webcam recording addencpassword
|
||||
removeencpassword removeallencpasswords keyboardputstring
|
||||
keyboardputfile audioin audioout setscreenlayout changeuartmode1
|
||||
changeuartmode2 vm-process-priority)
|
||||
|
||||
_find_item_name 2
|
||||
subcommand=${COMP_WORDS[$((index+1))]}
|
||||
|
||||
if [[ " ${items[@]} " == *" $subcommand "* ]]; then
|
||||
case "${subcommand}" in
|
||||
videocapfile|keyboardputfile|nictracefile[1-8])
|
||||
keyboardputfile|nictracefile[1-8])
|
||||
[[ ${prev} == "nictracefile"* ]] && \
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
;;
|
||||
@@ -683,14 +837,28 @@ _VBoxManage() {
|
||||
;;
|
||||
draganddrop)
|
||||
[[ ${prev} == "draganddrop" ]] && \
|
||||
COMPREPLY=( $(compgen -W "disabled
|
||||
hosttoguest" -- ${cur}) )
|
||||
COMPREPLY=( $(compgen -W "disabled hosttoguest
|
||||
guesttohost bidirectional" -- ${cur}) )
|
||||
;;
|
||||
vrde|videocap)
|
||||
[[ ${prev} == "vrde" ||
|
||||
${prev} == "videocap" ]] && \
|
||||
vrde)
|
||||
[[ ${prev} == "vrde" ]] && \
|
||||
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)
|
||||
[[ ${prev} == "videocapscreens" ]] && \
|
||||
COMPREPLY=( $(compgen -W "all none" -- ${cur}) )
|
||||
@@ -729,6 +897,17 @@ _VBoxManage() {
|
||||
_get_excluded_items "${tmp[@]}"
|
||||
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
|
||||
elif [[ ${prev} == "--passwordfile" || ${prev} == "--capturefile" ]]; then
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
@@ -789,7 +968,7 @@ _VBoxManage() {
|
||||
;;
|
||||
--variant)
|
||||
COMPREPLY=( $(compgen -W "Standard Fixed Split2G
|
||||
Stream ESX" -- ${cur}) )
|
||||
Stream ESX Formatted" -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
@@ -798,7 +977,8 @@ _VBoxManage() {
|
||||
;;
|
||||
|
||||
createvm)
|
||||
items=(--name --groups --ostype --register --basefolder --uuid)
|
||||
items=(--name --groups --ostype --register --basefolder --uuid
|
||||
--default)
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
COMPREPLY=( $(compgen -W "${items[*]}" -- ${cur}) )
|
||||
else
|
||||
@@ -879,39 +1059,143 @@ _VBoxManage() {
|
||||
;;
|
||||
|
||||
dhcpserver)
|
||||
items=(add modify remove)
|
||||
items=(add modify remove restart findlease)
|
||||
subcommand=${COMP_WORDS[2]}
|
||||
if [[ " ${items[@]} " == *" $subcommand "* ]]; then
|
||||
case "${subcommand}" in
|
||||
add|modify)
|
||||
items=(--ip --netmask --lowerip --upperip)
|
||||
|
||||
[[ " ${COMP_WORDS[@]} " != *" --ifname"* &&
|
||||
" ${COMP_WORDS[@]} " != *" --netname"* ]] &&
|
||||
items+=(--netname --ifname)
|
||||
add)
|
||||
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+=(--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[@]}"
|
||||
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
|
||||
--netname)
|
||||
--network)
|
||||
COMPREPLY=()
|
||||
_dhcp_comp
|
||||
;;
|
||||
--ifname)
|
||||
--interface)
|
||||
COMPREPLY=()
|
||||
_hostonlyif_comp
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ " ${COMP_WORDS[@]} " != *" --ifname"* &&
|
||||
" ${COMP_WORDS[@]} " != *" --netname"* ]]; then
|
||||
items=(--netname --ifname)
|
||||
if [[ " ${COMP_WORDS[@]} " != *" --interface"* &&
|
||||
" ${COMP_WORDS[@]} " != *" --network"* ]]; then
|
||||
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[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
fi
|
||||
@@ -942,11 +1226,15 @@ _VBoxManage() {
|
||||
;;
|
||||
|
||||
"export")
|
||||
items=( --manifest --iso --options --vsys)
|
||||
items=( --manifest --iso --options --vsys --cloud )
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
_vms_comp vms
|
||||
elif [[ ${prev} == "--eulafile" ]]; then
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
elif [[ ${prev} == "--cloudkeepobject" ||
|
||||
${prev} == "--cloudlaunchinstance" ||
|
||||
${prev} == "--cloudpublicip" ]]; then
|
||||
COMPREPLY=( $(compgen -W "true false" -- ${cur}) )
|
||||
else
|
||||
[[ " ${COMP_WORDS[@]} " != *" -o "* &&
|
||||
" ${COMP_WORDS[@]} " != *" --output "* ]] &&
|
||||
@@ -959,7 +1247,12 @@ _VBoxManage() {
|
||||
items+=(--legacy09 --ovf09 --ovf10 --ovf20 --opc10)
|
||||
[[ " ${COMP_WORDS[@]} " == *" --vsys "* ]] &&
|
||||
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[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
|
||||
@@ -968,6 +1261,10 @@ _VBoxManage() {
|
||||
COMPREPLY=( $(compgen -W "manifest iso nomacs
|
||||
nomacsbutnat" -- ${cur}) )
|
||||
;;
|
||||
--cloudlaunchmode)
|
||||
COMPREPLY=( $(compgen -W "EMULATED PARAVIRTUALIZED" \
|
||||
-- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
[[ ${#COMPREPLY[@]} -eq 0 ]] && \
|
||||
COMPREPLY=( $(compgen -W "${items[*]}" -- ${cur}) )
|
||||
@@ -1029,8 +1326,8 @@ _VBoxManage() {
|
||||
--ignore-operhaned-processes --profile
|
||||
--dos2unix --unix2dos --username --domain --)
|
||||
|
||||
[[ " ${comp_words[@]} " != *" --password "* ||
|
||||
" ${comp_words[@]} " != *" --passwordfile "* ]] &&
|
||||
[[ " ${COMP_WORDS[@]} " != *" --password "* ||
|
||||
" ${COMP_WORDS[@]} " != *" --passwordfile "* ]] &&
|
||||
items+=(--passwordfile --password)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --putenv "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -E "* ]] &&
|
||||
@@ -1057,8 +1354,8 @@ _VBoxManage() {
|
||||
--ignore-operhaned-processes --profile
|
||||
--username --domain --passwordfile --password --)
|
||||
|
||||
[[ " ${comp_words[@]} " != *" --password "* ||
|
||||
" ${comp_words[@]} " != *" --passwordfile "* ]] &&
|
||||
[[ " ${COMP_WORDS[@]} " != *" --password "* ||
|
||||
" ${COMP_WORDS[@]} " != *" --passwordfile "* ]] &&
|
||||
items+=(--passwordfile --password)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --verbose "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -v "* ]] &&
|
||||
@@ -1072,14 +1369,14 @@ _VBoxManage() {
|
||||
;;
|
||||
|
||||
copyfrom|copyto)
|
||||
items=(--dryrun --follow --target-directory
|
||||
--username --domain)
|
||||
items=(--follow --target-directory --username
|
||||
--domain)
|
||||
|
||||
[[ " ${COMP_WORDS[@]} " != *" --recursive "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -R "* ]] &&
|
||||
items+=(--recursive -R)
|
||||
[[ " ${comp_words[@]} " != *" --password "* ||
|
||||
" ${comp_words[@]} " != *" --passwordfile "* ]] &&
|
||||
[[ " ${COMP_WORDS[@]} " != *" --password "* ||
|
||||
" ${COMP_WORDS[@]} " != *" --passwordfile "* ]] &&
|
||||
items+=(--passwordfile --password)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --verbose "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -v "* ]] &&
|
||||
@@ -1395,7 +1692,8 @@ _VBoxManage() {
|
||||
;;
|
||||
|
||||
import)
|
||||
items=(--options)
|
||||
items=(--options --dry-run -n --vmname --cloud --cloudprofile
|
||||
--cloudinstanceid --cloudbucket)
|
||||
if [[ "${prev}" == "import" ]]; then
|
||||
COMPREPLY=( $(compgen -o plusdirs -f -X '!@(*.ovf|*.ova)' \
|
||||
-- ${cur}) )
|
||||
@@ -1435,6 +1733,31 @@ _VBoxManage() {
|
||||
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)
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
COMPREPLY=( $(compgen -W "disk dvd floppy" -- ${cur}) )
|
||||
@@ -1522,7 +1845,7 @@ _VBoxManage() {
|
||||
*)
|
||||
_find_item_name 2
|
||||
items=(--type --autoreset --property --compact --resize
|
||||
--move --description)
|
||||
--move --description --setlocation)
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
case "${prev}" in
|
||||
@@ -1537,6 +1860,9 @@ _VBoxManage() {
|
||||
--move)
|
||||
COMPREPLY=( $(compgen -o dirnames -- ${cur}) )
|
||||
;;
|
||||
--setlocation)
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
@@ -1545,7 +1871,7 @@ _VBoxManage() {
|
||||
|
||||
modifyvm)
|
||||
items=(--name --groups --description --ostype --iconfile --memory
|
||||
--pagefusion --vram --acpi --pciattach --pcidetach --ioapic --hpet
|
||||
--pagefusion --vram --acpi --ioapic --hpet
|
||||
--triplefaultreset --hwvirtex --nestedpaging --largepages --vtxvpid
|
||||
--vtxux --pae --longmode --cpuid-set --cpuid-remove
|
||||
--cpuidremoveall --hardwareuuid --cpus --cpuhotplug --plugcpu
|
||||
@@ -1604,21 +1930,23 @@ _VBoxManage() {
|
||||
--macaddress3 --macaddress4 --macaddress5 --macaddress6
|
||||
--macaddress7 --macaddress8 --mouse --keyboard --uart1 --uartmode1
|
||||
--uart2 --uartmode2 --lpt1 --lptmode1 --guestmemoryballoon --audio
|
||||
--audiocontroller --clipboard --draganddrop --vrde --vrdeextpack
|
||||
--audiocontroller --clipboard-mode --draganddrop --vrde --vrdeextpack
|
||||
--vrdeproperty --vrdeport --vrdeaddress --vrdeauthtype
|
||||
--vrdeauthlibrary --vrdemulticon --vrdereusecon --vrdevideochannel
|
||||
--vrdevideochannelquality --usb --usbehci --snapshotfolder
|
||||
--vrdevideochannelquality --usbohci --usbehci --snapshotfolder
|
||||
--teleporter --teleporterport --teleporteraddress
|
||||
--teleporterpassword --teleporterpasswordfile --tracing-enabled
|
||||
--tracing-config --tracing-allow-vm-access --usbcardreader
|
||||
--autostart-enabled --autostart-delay --videocap --videocapscreens
|
||||
--videocapfile --videocapres --videocaprate --videocapfps
|
||||
--videocapmaxtime --videocapmaxsize --videocapopts --defaultfrontend
|
||||
--cpuid-portability-level --paravirtprovider --audiocodec --usbxhci
|
||||
--usbrename --apic --x2apic --paravirtdebug --cpu-profile
|
||||
--biosapic --videocapopts --ibpb-on-vm-entry --ibpb-on-vm-exit
|
||||
--spec-ctrl --audioin --audioout --l1d-flush-on-sched
|
||||
--l1d-flush-on-vm-entry)
|
||||
--autostart-enabled --autostart-delay --recording --recordingscreens
|
||||
--recordingfile --recordingvideores --recordingvideorate
|
||||
--recordingvideofps --recordingmaxtime --recordingmaxsize
|
||||
--recordingopts --defaultfrontend --cpuid-portability-level
|
||||
--paravirtprovider --audiocodec --usbxhci --usbrename --apic
|
||||
--x2apic --paravirtdebug --cpu-profile --biosapic --ibpb-on-vm-entry
|
||||
--ibpb-on-vm-exit --spec-ctrl --audioin --audioout
|
||||
--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
|
||||
_vms_comp vms
|
||||
@@ -1654,17 +1982,19 @@ _VBoxManage() {
|
||||
--natdnshostresolver3|--natdnshostresolver4|\
|
||||
--natdnshostresolver5|--natdnshostresolver6|\
|
||||
--natdnshostresolver7|--natdnshostresolver8|--vrde|\
|
||||
--vrdemulticon|--vrdereusecon|--vrdevideochannel|--usb|\
|
||||
--vrdemulticon|--vrdereusecon|--vrdevideochannel|--usbohci|\
|
||||
--usbehci|--teleporter|--tracing-enabled|\
|
||||
--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|\
|
||||
--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|\
|
||||
--nested-hw-virt|--system-uuid-le)
|
||||
COMPREPLY=( $(compgen -W "on off" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--graphicscontroller)
|
||||
COMPREPLY=( $(compgen -W "none vboxvga vmsvga" \
|
||||
COMPREPLY=( $(compgen -W "none vboxvga vmsvga vboxsvga" \
|
||||
-- ${cur}) )
|
||||
;;
|
||||
|
||||
@@ -1693,8 +2023,8 @@ _VBoxManage() {
|
||||
;;
|
||||
|
||||
--nictype[1-8])
|
||||
COMPREPLY=( $(compgen -W "Am79C970A Am79C973 82540EM
|
||||
82543GC 82545EM virtio" -- ${cur}) )
|
||||
COMPREPLY=( $(compgen -W "Am79C970A Am79C973 Am79C960
|
||||
82540EM 82543GC 82545EM virtio" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--nicpromisc[1-8])
|
||||
@@ -1739,66 +2069,71 @@ _VBoxManage() {
|
||||
;;
|
||||
|
||||
--natpf[1-8])
|
||||
COMPREPLY+=( $(compgen -W "delete" -- ${cur}) )
|
||||
COMPREPLY=( $(compgen -W "delete" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--nataliasmode[1-8])
|
||||
COMPREPLY+=( $(compgen -W "default" -- ${cur}) )
|
||||
COMPREPLY=( $(compgen -W "default" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--macaddress[1-8])
|
||||
COMPREPLY+=( $(compgen -W "auto" -- ${cur}) )
|
||||
COMPREPLY=( $(compgen -W "auto" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--mouse)
|
||||
COMPREPLY+=( $(compgen -W "ps2 usb usbtablet
|
||||
COMPREPLY=( $(compgen -W "ps2 usb usbtablet
|
||||
usbmultitouch" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--keyboard)
|
||||
COMPREPLY+=( $(compgen -W "ps2 usb" -- ${cur}) )
|
||||
COMPREPLY=( $(compgen -W "ps2 usb" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--uart[1-2]|--lpt[1-2])
|
||||
COMPREPLY+=( $(compgen -W "off" -- ${cur}) )
|
||||
COMPREPLY=( $(compgen -W "off" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--uartmode[1-2])
|
||||
COMPREPLY+=( $(compgen -W "disconnected server client
|
||||
COMPREPLY=( $(compgen -W "disconnected server client
|
||||
tcpserver tcpclient file" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--uarttype[1-2])
|
||||
COMPREPLY=( $(compgen -W "16450 16550A
|
||||
16750" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--audio)
|
||||
COMPREPLY+=( $(compgen -W "none null oss alsa pulse" \
|
||||
COMPREPLY=( $(compgen -W "none null oss alsa pulse" \
|
||||
-- ${cur}) )
|
||||
;;
|
||||
|
||||
--audiocontroller)
|
||||
COMPREPLY+=( $(compgen -W "ac97 hda sb16" -- ${cur}) )
|
||||
COMPREPLY=( $(compgen -W "ac97 hda sb16" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--audiocodec)
|
||||
COMPREPLY+=( $(compgen -W "stac9700 ad1980 stac9221
|
||||
COMPREPLY=( $(compgen -W "stac9700 ad1980 stac9221
|
||||
sb16" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--clipboard)
|
||||
COMPREPLY+=( $(compgen -W "disabled hosttoguest
|
||||
--clipboard-mode)
|
||||
COMPREPLY=( $(compgen -W "disabled hosttoguest
|
||||
guesttohost bidirectional" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--draganddrop)
|
||||
COMPREPLY+=( $(compgen -W "disabled hosttoguest" \
|
||||
-- ${cur}) )
|
||||
COMPREPLY=( $(compgen -W "disabled hosttoguest
|
||||
guesttohost bidirectional" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--vrdeextpack|--vrdeauthlibrary|--snapshotfolder|\
|
||||
--defaultfrontend)
|
||||
COMPREPLY+=( $(compgen -W "default" -- ${cur}) )
|
||||
COMPREPLY=( $(compgen -W "default" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--vrdeauthtype)
|
||||
COMPREPLY+=( $(compgen -W "null external guest" \
|
||||
COMPREPLY=( $(compgen -W "null external guest" \
|
||||
-- ${cur}) )
|
||||
;;
|
||||
|
||||
@@ -1820,7 +2155,7 @@ _VBoxManage() {
|
||||
COMPREPLY=( $(compgen -W "disabled apic x2apic" \
|
||||
-- ${cur}) )
|
||||
;;
|
||||
--teleporterpasswordfile|--iconfile|--videocapfile)
|
||||
--teleporterpasswordfile|--iconfile|--recordingfile)
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
;;
|
||||
--nictracefile[1-8])
|
||||
@@ -1829,6 +2164,30 @@ _VBoxManage() {
|
||||
--nattftpfile[1-8])
|
||||
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
|
||||
fi
|
||||
;;
|
||||
@@ -1885,7 +2244,7 @@ _VBoxManage() {
|
||||
setproperty)
|
||||
items=(machinefolder hwvirtexclusive vrdeauthlibrary
|
||||
websrvauthlibrary vrdeextpack autostartdbpath loghistorycount
|
||||
defaultfrontend logginglevel)
|
||||
defaultfrontend logginglevel proxymode proxyurl)
|
||||
subcommand=${COMP_WORDS[2]}
|
||||
if [[ "${prev}" == "${cmd}" ]]; then
|
||||
COMPREPLY=( $(compgen -W "${items[*]}" -- ${cur}) )
|
||||
@@ -1912,6 +2271,10 @@ _VBoxManage() {
|
||||
defaultfrontend)
|
||||
COMPREPLY=( $(compgen -W "null" -- ${cur}) )
|
||||
;;
|
||||
proxymode)
|
||||
COMPREPLY=( $(compgen -W "system noproxy
|
||||
manual" -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
@@ -2036,8 +2399,16 @@ _VBoxManage() {
|
||||
;;
|
||||
esac
|
||||
else
|
||||
[[ ${#COMPREPLY[@]} -eq 0 ]] && \
|
||||
COMPREPLY=( $(compgen -W "${items[*]}" -- ${cur}) )
|
||||
case "$prev" in
|
||||
--uniquename)
|
||||
COMPREPLY=( $(compgen -W "Number Timestamp Space
|
||||
Force" -- ${cur}) )
|
||||
;;
|
||||
*)
|
||||
[[ ${#COMPREPLY[@]} -eq 0 ]] && \
|
||||
COMPREPLY=( $(compgen -W "${items[*]}" \
|
||||
-- ${cur}) )
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
Reference in New Issue
Block a user