mirror of
https://github.com/gryf/vboxmanage-bash-completion.git
synced 2025-12-19 20:38:05 +01:00
Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c8301459df | |||
| ab0cc7aea4 | |||
| f73e80c7ad | |||
| 10900543fa | |||
| 1be3e589d4 | |||
| 9c5b048c62 | |||
| 5fd18d7cec | |||
| 05af06f337 | |||
| cde78c8e4c | |||
|
|
197c46cd35 | ||
|
|
296be19560 | ||
| 62f57ebbb7 | |||
| d4f56a0d6b | |||
| f8b5981935 | |||
| d027094e7c | |||
| e90270e8ee | |||
| 11a0844c4d | |||
| 9b06c430fd | |||
| fbdd259cac | |||
| d79a8bc280 | |||
| 20b1ef9fab | |||
| 1674acbe92 | |||
| 9b7ab10421 | |||
| 47e3ff6bbe | |||
| f81bfe514f | |||
| a78a03286a | |||
| 04fba0a65a | |||
| 26eeb62a6d |
@@ -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.0.18, and supports all commands (in some extent ;)).
|
||||
6.0.12, 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:
|
||||
|
||||
451
VBoxManage
451
VBoxManage
@@ -1,7 +1,10 @@
|
||||
# bash command-line completion for VBoxManage command
|
||||
#
|
||||
# Author: Roman 'gryf' Dobosz <gryf73@gmail.com>
|
||||
# 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: 6.0.12
|
||||
|
||||
_VBoxManage() {
|
||||
local cur prev opts cmd subcommand tmp items name index result
|
||||
@@ -39,6 +42,18 @@ _VBoxManage() {
|
||||
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.
|
||||
# NOTE: This function may introduce some quirks, if there is a space or
|
||||
# other characters which usually are treated as IFS - like space. Pipe
|
||||
@@ -256,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[@]}"
|
||||
@@ -305,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}) )
|
||||
}
|
||||
|
||||
@@ -438,6 +452,10 @@ _VBoxManage() {
|
||||
sort | \
|
||||
uniq)
|
||||
|
||||
# Add some commands manually, since they are listed differently in
|
||||
# vboxmanage help.
|
||||
opts="${opts} mediumio debugvm unattended extpack"
|
||||
|
||||
if [[ ${cur} == "-q" || ${COMP_CWORD} -eq 1 ]] ; then
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
||||
return 0
|
||||
@@ -497,6 +515,7 @@ _VBoxManage() {
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
checkmediumpwd)
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
_hdd_comp
|
||||
@@ -560,7 +579,7 @@ _VBoxManage() {
|
||||
;;
|
||||
--options)
|
||||
COMPREPLY=( $(compgen -W "link keepallmacs keepnatmacs
|
||||
keepdisknames" -- ${cur}) )
|
||||
keepdisknames keephwuuids" -- ${cur}) )
|
||||
;;
|
||||
--groups)
|
||||
COMPREPLY=()
|
||||
@@ -618,18 +637,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)
|
||||
|
||||
vrdevideochannelquality webcam recording addencpassword
|
||||
removeencpassword removeallencpasswords keyboardputstring
|
||||
keyboardputfile audioin audioout setscreenlayout changeuartmode1
|
||||
changeuartmode2)
|
||||
|
||||
_find_item_name 2
|
||||
subcommand=${COMP_WORDS[$((index+1))]}
|
||||
|
||||
if [[ " ${items[@]} " == *" $subcommand "* ]]; then
|
||||
case "${subcommand}" in
|
||||
nictracefile[1-8])
|
||||
keyboardputfile|nictracefile[1-8])
|
||||
[[ ${prev} == "nictracefile"* ]] && \
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
;;
|
||||
@@ -652,7 +670,7 @@ _VBoxManage() {
|
||||
COMPREPLY=( $(compgen -W "delete tcp
|
||||
udp" -- ${cur}) )
|
||||
;;
|
||||
setlinkstate[1-8])
|
||||
audioin|audioout|setlinkstate[1-8])
|
||||
[[ ${prev} == "setlinkstate"* ]] && \
|
||||
COMPREPLY=( $(compgen -W "on off" -- ${cur}) )
|
||||
;;
|
||||
@@ -663,14 +681,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}) )
|
||||
@@ -700,18 +732,24 @@ _VBoxManage() {
|
||||
_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}) )
|
||||
;;
|
||||
changeuartmode[1-2])
|
||||
tmp=(disconnected server client tcpserver tcpclient
|
||||
file "<devicename>")
|
||||
_get_excluded_items "${tmp[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
elif [[ ${prev} == "--passwordfile" || ${prev} == "--capturefile" ]]; then
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
else
|
||||
[[ ${#COMPREPLY[@]} -eq 0 ]] && \
|
||||
COMPREPLY=( $(compgen -W "${items[*]}" -- ${cur}) )
|
||||
@@ -757,7 +795,7 @@ _VBoxManage() {
|
||||
|
||||
case "${prev}" in
|
||||
--filename)
|
||||
COMPREPLY=( $(compgen -- ${cur}) )
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
;;
|
||||
--diffparent)
|
||||
COMPREPLY=()
|
||||
@@ -769,7 +807,7 @@ _VBoxManage() {
|
||||
;;
|
||||
--variant)
|
||||
COMPREPLY=( $(compgen -W "Standard Fixed Split2G
|
||||
Stream ESX" -- ${cur}) )
|
||||
Stream ESX Formatted" -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
@@ -778,7 +816,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
|
||||
@@ -805,9 +844,9 @@ _VBoxManage() {
|
||||
fi
|
||||
;;
|
||||
|
||||
debugvm)
|
||||
"debugvm")
|
||||
items=(dumpguestcore info injectnmi log logdest logflags osdetect
|
||||
osinfo osdmesg getregisters setregisters show statistics)
|
||||
osinfo osdmesg getregisters setregisters show statistics stack)
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
_vms_comp runningvms
|
||||
else
|
||||
@@ -824,7 +863,7 @@ _VBoxManage() {
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
getregisters|setregisters)
|
||||
getregisters|setregisters|stack)
|
||||
_get_excluded_items "--cpu"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
@@ -835,7 +874,7 @@ _VBoxManage() {
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
statistics)
|
||||
items=(--reset --pattern)
|
||||
items=(--reset --pattern --descriptions)
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
@@ -848,11 +887,10 @@ _VBoxManage() {
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
_get_excluded_items "--descriptions"
|
||||
COMPREPLY+=( $(compgen -W "$result" -- ${cur}) )
|
||||
else
|
||||
[[ "${prev}" == "--filename" ]] && \
|
||||
COMPREPLY=( $(compgen -- ${cur}) )
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
[[ ${#COMPREPLY[@]} -eq 0 ]] && \
|
||||
COMPREPLY=( $(compgen -W "${items[*]}" -- ${cur}) )
|
||||
fi
|
||||
@@ -865,7 +903,7 @@ _VBoxManage() {
|
||||
if [[ " ${items[@]} " == *" $subcommand "* ]]; then
|
||||
case "${subcommand}" in
|
||||
add|modify)
|
||||
items=(--ip --netmask --lowerip --upperip)
|
||||
items=(--ip --netmask --lowerip --upperip --options)
|
||||
|
||||
[[ " ${COMP_WORDS[@]} " != *" --ifname"* &&
|
||||
" ${COMP_WORDS[@]} " != *" --netname"* ]] &&
|
||||
@@ -875,6 +913,9 @@ _VBoxManage() {
|
||||
" ${COMP_WORDS[@]} " != *" --disable"* ]] &&
|
||||
items+=(--enable --disable)
|
||||
|
||||
[[ " ${COMP_WORDS[@]} " == *" --options"* ]] &&
|
||||
items+=(--vm --nic --id --value --remove)
|
||||
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
@@ -919,14 +960,19 @@ _VBoxManage() {
|
||||
else
|
||||
COMPREPLY=( $(compgen -W "--newpassword --oldpassword --cipher
|
||||
--newpasswordid" -- ${cur}) )
|
||||
|
||||
fi
|
||||
;;
|
||||
|
||||
"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 "* ]] &&
|
||||
@@ -934,11 +980,16 @@ _VBoxManage() {
|
||||
[[ " ${COMP_WORDS[@]} " != *" --legacy09 "* &&
|
||||
" ${COMP_WORDS[@]} " != *" --ovf09 "* &&
|
||||
" ${COMP_WORDS[@]} " != *" --ovf10 "* &&
|
||||
" ${COMP_WORDS[@]} " != *" --ovf20 "* ]] &&
|
||||
items+=(--legacy09 --ovf09 --ovf10 --ovf20)
|
||||
" ${COMP_WORDS[@]} " != *" --ovf20 "* &&
|
||||
" ${COMP_WORDS[@]} " != *" --opc20 "* ]] &&
|
||||
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)
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
|
||||
@@ -947,6 +998,7 @@ _VBoxManage() {
|
||||
COMPREPLY=( $(compgen -W "manifest iso nomacs
|
||||
nomacsbutnat" -- ${cur}) )
|
||||
;;
|
||||
|
||||
esac
|
||||
[[ ${#COMPREPLY[@]} -eq 0 ]] && \
|
||||
COMPREPLY=( $(compgen -W "${items[*]}" -- ${cur}) )
|
||||
@@ -1005,11 +1057,11 @@ _VBoxManage() {
|
||||
case "${subcommand}" in
|
||||
run)
|
||||
items=(--exe --timeout --unquoted-args
|
||||
--ignore-operhaned-processes --no-profile
|
||||
--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 "* ]] &&
|
||||
@@ -1033,11 +1085,11 @@ _VBoxManage() {
|
||||
|
||||
start)
|
||||
items=(--exe --timeout --unquoted-args
|
||||
--ignore-operhaned-processes --no-profile
|
||||
--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 "* ]] &&
|
||||
@@ -1051,14 +1103,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 "* ]] &&
|
||||
@@ -1244,6 +1296,7 @@ _VBoxManage() {
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
fi
|
||||
;;
|
||||
|
||||
updatega|updateguestadditions|updateadditions)
|
||||
items=(--source --wait-start)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --verbose "* &&
|
||||
@@ -1256,6 +1309,7 @@ _VBoxManage() {
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
|
||||
watch)
|
||||
items=()
|
||||
[[ " ${COMP_WORDS[@]} " != *" --verbose "* &&
|
||||
@@ -1269,6 +1323,7 @@ _VBoxManage() {
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
|
||||
case "${prev}" in
|
||||
close)
|
||||
items=(--verbose)
|
||||
@@ -1282,7 +1337,7 @@ _VBoxManage() {
|
||||
--image)
|
||||
COMPREPLY=( $(compgen -- ${cur}) )
|
||||
;;
|
||||
--tmpdir)
|
||||
--target-directory|--tmpdir)
|
||||
COMPREPLY=( $(compgen -o dirnames -- ${cur}) )
|
||||
;;
|
||||
--source)
|
||||
@@ -1293,6 +1348,9 @@ _VBoxManage() {
|
||||
"${COMPREPLY[0]}" != *".iso" ]] && \
|
||||
COMPREPLY[0]="${COMPREPLY[0]}/"
|
||||
;;
|
||||
--passwordfile)
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
else
|
||||
[[ ${#COMPREPLY[@]} -eq 0 ]] && \
|
||||
@@ -1395,12 +1453,40 @@ _VBoxManage() {
|
||||
_list_comp ${cur}
|
||||
else
|
||||
case "${prev}" in
|
||||
--long|-l)
|
||||
COMPREPLY=()
|
||||
;;
|
||||
*)
|
||||
--sorted|-s)
|
||||
COMPREPLY=( $(compgen -W "-l --long" -- ${cur}) )
|
||||
;;
|
||||
--long|-l)
|
||||
COMPREPLY=( $(compgen -W "-s --sorted" -- ${cur}) )
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=( $(compgen -W "-l --long -s --sorted" -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
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
|
||||
;;
|
||||
@@ -1467,14 +1553,12 @@ _VBoxManage() {
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
fi
|
||||
|
||||
;;
|
||||
esac
|
||||
else
|
||||
[[ ${#COMPREPLY[@]} -eq 0 ]] && \
|
||||
COMPREPLY=( $(compgen -W "${items[*]}" -- ${cur}) )
|
||||
fi
|
||||
|
||||
;;
|
||||
|
||||
modifymedium)
|
||||
@@ -1493,7 +1577,8 @@ _VBoxManage() {
|
||||
;;
|
||||
*)
|
||||
_find_item_name 2
|
||||
items=(--type --autoreset --property --compact --resize)
|
||||
items=(--type --autoreset --property --compact --resize
|
||||
--move --description --setlocation)
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
case "${prev}" in
|
||||
@@ -1505,6 +1590,12 @@ _VBoxManage() {
|
||||
--autoreset)
|
||||
COMPREPLY=( $(compgen -W "on off" -- ${cur}) )
|
||||
;;
|
||||
--move)
|
||||
COMPREPLY=( $(compgen -o dirnames -- ${cur}) )
|
||||
;;
|
||||
--setlocation)
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
@@ -1515,7 +1606,7 @@ _VBoxManage() {
|
||||
items=(--name --groups --description --ostype --iconfile --memory
|
||||
--pagefusion --vram --acpi --pciattach --pcidetach --ioapic --hpet
|
||||
--triplefaultreset --hwvirtex --nestedpaging --largepages --vtxvpid
|
||||
--vtxux --pae --longmode --cpuidset --cpuidremove
|
||||
--vtxux --pae --longmode --cpuid-set --cpuid-remove
|
||||
--cpuidremoveall --hardwareuuid --cpus --cpuhotplug --plugcpu
|
||||
--unplugcpu --cpuexecutioncap --rtcuseutc --graphicscontroller
|
||||
--monitorcount --accelerate3d --accelerate2dvideo --firmware
|
||||
@@ -1575,15 +1666,19 @@ _VBoxManage() {
|
||||
--audiocontroller --clipboard --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)
|
||||
--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)
|
||||
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
_vms_comp vms
|
||||
@@ -1595,10 +1690,12 @@ _VBoxManage() {
|
||||
COMPREPLY=()
|
||||
_group_comp
|
||||
;;
|
||||
|
||||
--ostype)
|
||||
COMPREPLY=()
|
||||
_os_comp
|
||||
;;
|
||||
|
||||
--pagefusion|--acpi|--ioapic|--hpet|--triplefaultreset|\
|
||||
--hwvirtex|--nestedpaging|--largepages|--vtxvpid|--vtxux|\
|
||||
--pae|--longmode|--cpuhotplug|--rtcuseutc|\
|
||||
@@ -1617,142 +1714,214 @@ _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)
|
||||
--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|\
|
||||
--mds-clear-on-sched|--mds-clear-on-vm-entry|\
|
||||
--nested-hw-virt)
|
||||
COMPREPLY=( $(compgen -W "on off" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--graphicscontroller)
|
||||
COMPREPLY=( $(compgen -W "none vboxvga vmsvga" \
|
||||
COMPREPLY=( $(compgen -W "none vboxvga vmsvga vboxsvga" \
|
||||
-- ${cur}) )
|
||||
;;
|
||||
|
||||
--firmware)
|
||||
COMPREPLY=( $(compgen -W "bios efi efi32 efi64" \
|
||||
-- ${cur}) )
|
||||
;;
|
||||
|
||||
--chipset)
|
||||
COMPREPLY=( $(compgen -W "ich9 piix3" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--biosbootmenu)
|
||||
COMPREPLY=( $(compgen -W "disabled menuonly
|
||||
messageandmenu" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--boot[1-4])
|
||||
COMPREPLY=( $(compgen -W "none floppy dvd disk net" \
|
||||
-- ${cur}) )
|
||||
;;
|
||||
|
||||
--nic[1-8])
|
||||
COMPREPLY=( $(compgen -W "none null nat bridged intnet
|
||||
hostonly generic natnetwork" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--nictype[1-8])
|
||||
COMPREPLY=( $(compgen -W "Am79C970A Am79C973 82540EM
|
||||
82543GC 82545EM virtio" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--nicpromisc[1-8])
|
||||
COMPREPLY=( $(compgen -W "deny allow-vms allow-all" \
|
||||
-- ${cur}) )
|
||||
;;
|
||||
|
||||
--nicbandwidthgroup[1-8])
|
||||
COMPREPLY=()
|
||||
_bandwidthctl_comp
|
||||
_get_excluded_items "none"
|
||||
COMPREPLY+=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--bridgeadapter[1-8])
|
||||
COMPREPLY=()
|
||||
_bridgedif_comp
|
||||
_get_excluded_items "none"
|
||||
COMPREPLY+=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--hostonlyadapter[1-8])
|
||||
COMPREPLY=()
|
||||
_hostonlyif_comp
|
||||
_get_excluded_items "none"
|
||||
COMPREPLY+=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--intnet[1-8])
|
||||
COMPREPLY=()
|
||||
_intnet_comp
|
||||
;;
|
||||
|
||||
--nat-network[1-8])
|
||||
COMPREPLY=()
|
||||
_natnet_comp
|
||||
;;
|
||||
|
||||
--natnet[1-8])
|
||||
COMPREPLY=()
|
||||
_natnet_comp
|
||||
;;
|
||||
|
||||
--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
|
||||
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}) )
|
||||
;;
|
||||
|
||||
--paravirtprovider)
|
||||
COMPREPLY=( $(compgen -W "none default legacy minimal
|
||||
hyperv kvm" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--cpuid-portability-level)
|
||||
COMPREPLY=( $(compgen -W "0 1 2 3" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--cpu-profile)
|
||||
COMPREPLY=( $(compgen -W "host 8086 80286 80386" \
|
||||
-- ${cur}) )
|
||||
;;
|
||||
|
||||
--biosapic)
|
||||
COMPREPLY=( $(compgen -W "disabled apic x2apic" \
|
||||
-- ${cur}) )
|
||||
;;
|
||||
--teleporterpasswordfile|--iconfile|--recordingfile)
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
;;
|
||||
--nictracefile[1-8])
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
;;
|
||||
--nattftpfile[1-8])
|
||||
COMPREPLY=( $(compgen -f -- ${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
|
||||
;;
|
||||
|
||||
natnetwork)
|
||||
items=(add remove modify start stop)
|
||||
items=(add remove modify start stop list)
|
||||
subcommand=${COMP_WORDS[2]}
|
||||
if [[ "${prev}" == "--netname" ]]; then
|
||||
_natnet_comp
|
||||
@@ -1803,7 +1972,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}) )
|
||||
@@ -1830,6 +1999,10 @@ _VBoxManage() {
|
||||
defaultfrontend)
|
||||
COMPREPLY=( $(compgen -W "null" -- ${cur}) )
|
||||
;;
|
||||
proxymode)
|
||||
COMPREPLY=( $(compgen -W "system noproxy
|
||||
manual" -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
@@ -1870,6 +2043,7 @@ _VBoxManage() {
|
||||
[[ ${#COMPREPLY[@]} -eq 0 ]] && \
|
||||
COMPREPLY=( $(compgen -W "${items[*]}" -- ${cur}) )
|
||||
;;
|
||||
|
||||
showmediuminfo)
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
COMPREPLY=( $(compgen -W "disk dvd floppy" -- ${cur}) )
|
||||
@@ -1965,7 +2139,13 @@ _VBoxManage() {
|
||||
elif [[ "${prev}" == "--type" ]]; then
|
||||
COMPREPLY=( $(compgen -W "gui sdl headless separate" -- ${cur}) )
|
||||
else
|
||||
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[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
fi
|
||||
@@ -1980,7 +2160,7 @@ _VBoxManage() {
|
||||
--comment --setuuid --setparentuuid --passthrough --tempeject
|
||||
--nonrotational --discard --hotpluggable --bandwidthgroup
|
||||
--forceunmount --server --target --tport --lun --encodedlun
|
||||
--username --password --initiator --intnet)
|
||||
--username --password --initiator --intnet --passwordfile)
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
|
||||
@@ -2006,6 +2186,9 @@ _VBoxManage() {
|
||||
--passthrough|--tempeject|--nonrotational|--discard)
|
||||
COMPREPLY=( $(compgen -W "on off" -- ${cur}) )
|
||||
;;
|
||||
--passwordfile)
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
@@ -2021,11 +2204,11 @@ _VBoxManage() {
|
||||
case "${prev}" in
|
||||
--add)
|
||||
COMPREPLY=( $(compgen -W "ide sata scsi floppy
|
||||
sas" -- ${cur}) )
|
||||
sas usb pcie" -- ${cur}) )
|
||||
;;
|
||||
--controller)
|
||||
COMPREPLY=( $(compgen -W "LSILogic LSILogicSAS BusLogic
|
||||
IntelAHCI PIIX3 PIIX4 ICH6 I82078" -- ${cur}) )
|
||||
IntelAHCI PIIX3 PIIX4 ICH6 I82078 USB NVMe" -- ${cur}) )
|
||||
;;
|
||||
--bootable|--hostiocache)
|
||||
COMPREPLY=( $(compgen -W "on off" -- ${cur}) )
|
||||
@@ -2044,7 +2227,7 @@ _VBoxManage() {
|
||||
fi
|
||||
;;
|
||||
|
||||
usbfilte)
|
||||
usbfilter)
|
||||
if [[ COMP_CWORD -ge 3 ]]; then
|
||||
subcommand="${COMP_WORDS[2]}"
|
||||
if [[ $subcommand == "${cmd}" ]]; then
|
||||
@@ -2085,8 +2268,92 @@ _VBoxManage() {
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
usbdevsource)
|
||||
if [[ COMP_CWORD -ge 3 ]]; then
|
||||
subcommand="${COMP_WORDS[2]}"
|
||||
if [[ $subcommand == "${cmd}" ]]; then
|
||||
subcommand="${COMP_WORDS[3]}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
COMPREPLY=( $(compgen -W "add remove" -- ${cur}) )
|
||||
else
|
||||
if [[ ${#COMPREPLY[@]} -eq 0 ]]; then
|
||||
case "${subcommand}" in
|
||||
add)
|
||||
local items=(--address --backend)
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
unattended)
|
||||
if [[ COMP_CWORD -ge 3 ]]; then
|
||||
subcommand="${COMP_WORDS[2]}"
|
||||
if [[ $subcommand == "${cmd}" ]]; then
|
||||
subcommand="${COMP_WORDS[3]}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
COMPREPLY=( $(compgen -W "detect install" -- ${cur}) )
|
||||
else
|
||||
case "${prev}" in
|
||||
--iso|--password-file|--additions-iso|--validation-kit-iso|\
|
||||
--script-template|--post-install-template)
|
||||
COMPREPLY+=( $(compgen -f -- ${cur}) )
|
||||
;;
|
||||
--auxiliary-base-path)
|
||||
COMPREPLY+=( $(compgen -o dirnames -- ${cur}) )
|
||||
;;
|
||||
--start-vm)
|
||||
COMPREPLY=( $(compgen -W "gui sdl headless separate" \
|
||||
-- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ ${#COMPREPLY[@]} -eq 0 ]]; then
|
||||
case "${subcommand}" in
|
||||
detect)
|
||||
local items=(--iso --machine-readable)
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
install)
|
||||
if [[ ${prev} == ${subcommand} ]]; then
|
||||
_vms_comp vms
|
||||
else
|
||||
local items=(--iso --user=login
|
||||
--password=password --password-file
|
||||
--full-user-name --key
|
||||
--install-additions --no-install-additions
|
||||
--additions-iso --install-txs --no-install-txs
|
||||
--validation-kit-iso --locale --country
|
||||
--time-zone --hostname
|
||||
--package-selection-adjustment --dry-run
|
||||
--auxiliary-base-path=path --image-index
|
||||
--script-template --post-install-template
|
||||
--post-install-command
|
||||
--extra-install-kernel-parameters --language
|
||||
--start-vm)
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
fi
|
||||
;;
|
||||
|
||||
esac
|
||||
}
|
||||
complete -o default -F _VBoxManage VBoxManage
|
||||
complete -o default -F _VBoxManage vboxmanage
|
||||
|
||||
# vim: set ft=sh tw=80 sw=4 et :
|
||||
|
||||
Reference in New Issue
Block a user