mirror of
https://github.com/gryf/vboxmanage-bash-completion.git
synced 2025-12-19 12:28:19 +01:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 62d9078b23 | |||
| 3f42dd2dc1 | |||
| 6ee3136033 | |||
| cf367c093d | |||
| 7174fe03db | |||
| f2d71065cb | |||
| 82e2fade6b | |||
| 8360d95123 | |||
| 12b0f38741 | |||
| 808c4ac277 | |||
|
|
31a7eec15a | ||
|
|
0ffc79dbe2 | ||
|
|
1ed71c9253 |
@@ -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
|
||||||
6.1.0, and should contain all commands and their options.
|
6.1.36, 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:
|
||||||
|
|||||||
174
VBoxManage
174
VBoxManage
@@ -4,11 +4,15 @@
|
|||||||
# 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: 6.1.0
|
# Version: 6.1.36
|
||||||
|
|
||||||
|
|
||||||
_VBoxManage() {
|
_VBoxManage() {
|
||||||
local cur prev opts cmd subcommand tmp items name index result
|
local cur prev opts cmd subcommand tmp items name index result
|
||||||
|
|
||||||
|
# env var GNUSED is either empty or points to a gnu sed executable
|
||||||
|
VBMC_SED=${GNUSED:-sed}
|
||||||
|
|
||||||
# Check the COMP_WORDS looking for name of the vm. If name contain space or
|
# Check the COMP_WORDS looking for name of the vm. If name contain space or
|
||||||
# is enclosed in quotes, glue name together in variable name. Variable index
|
# is enclosed in quotes, glue name together in variable name. Variable index
|
||||||
# will hold the last index of COMP_WORDS array which contain the end of the
|
# will hold the last index of COMP_WORDS array which contain the end of the
|
||||||
@@ -65,10 +69,10 @@ _VBoxManage() {
|
|||||||
hdds=$(VBoxManage list hdds | \
|
hdds=$(VBoxManage list hdds | \
|
||||||
grep -A 1 'normal (base)' | \
|
grep -A 1 'normal (base)' | \
|
||||||
grep "Location:" | \
|
grep "Location:" | \
|
||||||
sed 's/Location:\s\+//' | \
|
$VBMC_SED 's/Location:\s\+//' | \
|
||||||
sed 's/\s/\\ /g' | \
|
$VBMC_SED 's/\s/\\ /g' | \
|
||||||
tr '\n' '|' | \
|
tr '\n' '|' | \
|
||||||
sed 's/|$//')
|
$VBMC_SED 's/|$//')
|
||||||
IFS='|' read -ra hdds <<< "$hdds"
|
IFS='|' read -ra hdds <<< "$hdds"
|
||||||
|
|
||||||
for item in "${hdds[@]}"
|
for item in "${hdds[@]}"
|
||||||
@@ -83,10 +87,10 @@ _VBoxManage() {
|
|||||||
|
|
||||||
floppies=$(VBoxManage list floppies | \
|
floppies=$(VBoxManage list floppies | \
|
||||||
grep "Location:" | \
|
grep "Location:" | \
|
||||||
sed 's/Location:\s\+//' | \
|
$VBMC_SED 's/Location:\s\+//' | \
|
||||||
sed 's/\s/\\ /g' | \
|
$VBMC_SED 's/\s/\\ /g' | \
|
||||||
tr '\n' '|' | \
|
tr '\n' '|' | \
|
||||||
sed 's/|$//')
|
$VBMC_SED 's/|$//')
|
||||||
IFS='|' read -ra floppies <<< "$floppies"
|
IFS='|' read -ra floppies <<< "$floppies"
|
||||||
|
|
||||||
for item in "${floppies[@]}"
|
for item in "${floppies[@]}"
|
||||||
@@ -101,10 +105,10 @@ _VBoxManage() {
|
|||||||
|
|
||||||
dvds=$(VBoxManage list dvds | \
|
dvds=$(VBoxManage list dvds | \
|
||||||
grep "Location:" | \
|
grep "Location:" | \
|
||||||
sed 's/Location:\s\+//' | \
|
$VBMC_SED 's/Location:\s\+//' | \
|
||||||
sed 's/\s/\\ /g' | \
|
$VBMC_SED 's/\s/\\ /g' | \
|
||||||
tr '\n' '|' | \
|
tr '\n' '|' | \
|
||||||
sed 's/|$//')
|
$VBMC_SED 's/|$//')
|
||||||
IFS='|' read -ra dvds <<< "$dvds"
|
IFS='|' read -ra dvds <<< "$dvds"
|
||||||
|
|
||||||
for item in "${dvds[@]}"
|
for item in "${dvds[@]}"
|
||||||
@@ -130,16 +134,16 @@ _VBoxManage() {
|
|||||||
running_vms=$(VBoxManage list runningvms | \
|
running_vms=$(VBoxManage list runningvms | \
|
||||||
awk -F ' {' '{ print $1 }' | \
|
awk -F ' {' '{ print $1 }' | \
|
||||||
tr '\n' '|' | \
|
tr '\n' '|' | \
|
||||||
sed 's/|$//' | \
|
$VBMC_SED 's/|$//' | \
|
||||||
sed 's/"//g')
|
$VBMC_SED 's/"//g')
|
||||||
IFS='|' read -ra running_vms <<< "$running_vms"
|
IFS='|' read -ra running_vms <<< "$running_vms"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
vms=$(VBoxManage list $command | \
|
vms=$(VBoxManage list $command | \
|
||||||
awk -F ' {' '{ print $1 }' | \
|
awk -F ' {' '{ print $1 }' | \
|
||||||
tr '\n' '|' | \
|
tr '\n' '|' | \
|
||||||
sed 's/|$//' | \
|
$VBMC_SED 's/|$//' | \
|
||||||
sed 's/"//g')
|
$VBMC_SED 's/"//g')
|
||||||
IFS='|' read -ra vms <<< "$vms"
|
IFS='|' read -ra vms <<< "$vms"
|
||||||
for item in "${vms[@]}"
|
for item in "${vms[@]}"
|
||||||
do
|
do
|
||||||
@@ -162,10 +166,10 @@ _VBoxManage() {
|
|||||||
vms=$(VBoxManage list vms -l | \
|
vms=$(VBoxManage list vms -l | \
|
||||||
egrep '^Name|State' | \
|
egrep '^Name|State' | \
|
||||||
egrep -B1 'State:\s+saved' | \
|
egrep -B1 'State:\s+saved' | \
|
||||||
grep Name |sed 's/Name:\s\+//' | \
|
grep Name |$VBMC_SED 's/Name:\s\+//' | \
|
||||||
tr '\n' '|' | \
|
tr '\n' '|' | \
|
||||||
sed 's/|$//' | \
|
$VBMC_SED 's/|$//' | \
|
||||||
sed 's/"//g')
|
$VBMC_SED 's/"//g')
|
||||||
IFS='|' read -ra vms <<< "$vms"
|
IFS='|' read -ra vms <<< "$vms"
|
||||||
for item in "${vms[@]}"
|
for item in "${vms[@]}"
|
||||||
do
|
do
|
||||||
@@ -179,9 +183,9 @@ _VBoxManage() {
|
|||||||
|
|
||||||
list=$(VBoxManage list groups | \
|
list=$(VBoxManage list groups | \
|
||||||
tr '\n' '|' | \
|
tr '\n' '|' | \
|
||||||
sed 's/|$//' | \
|
$VBMC_SED 's/|$//' | \
|
||||||
sed 's/\s/\\ /g'| \
|
$VBMC_SED 's/\s/\\ /g'| \
|
||||||
sed 's/"//g')
|
$VBMC_SED 's/"//g')
|
||||||
IFS='|' read -ra list <<< "$list"
|
IFS='|' read -ra list <<< "$list"
|
||||||
|
|
||||||
for item in "${list[@]}"
|
for item in "${list[@]}"
|
||||||
@@ -196,9 +200,9 @@ _VBoxManage() {
|
|||||||
|
|
||||||
list=$(VBoxManage list ostypes | \
|
list=$(VBoxManage list ostypes | \
|
||||||
egrep ^ID: | \
|
egrep ^ID: | \
|
||||||
sed 's/ID:\s\+//' | \
|
$VBMC_SED 's/ID:\s\+//' | \
|
||||||
tr '\n' '|' | \
|
tr '\n' '|' | \
|
||||||
sed 's/|$//')
|
$VBMC_SED 's/|$//')
|
||||||
IFS='|' read -ra list <<< "$list"
|
IFS='|' read -ra list <<< "$list"
|
||||||
|
|
||||||
for item in "${list[@]}"
|
for item in "${list[@]}"
|
||||||
@@ -213,10 +217,10 @@ _VBoxManage() {
|
|||||||
|
|
||||||
list=$(VBoxManage list dhcpservers | \
|
list=$(VBoxManage list dhcpservers | \
|
||||||
grep NetworkName: | \
|
grep NetworkName: | \
|
||||||
sed 's/NetworkName:\s\+//' | \
|
$VBMC_SED 's/NetworkName:\s\+//' | \
|
||||||
sed 's/\s/\\ /g'| \
|
$VBMC_SED 's/\s/\\ /g'| \
|
||||||
tr '\n' '|' | \
|
tr '\n' '|' | \
|
||||||
sed 's/|$//')
|
$VBMC_SED 's/|$//')
|
||||||
IFS='|' read -ra list <<< "$list"
|
IFS='|' read -ra list <<< "$list"
|
||||||
|
|
||||||
for item in "${list[@]}"
|
for item in "${list[@]}"
|
||||||
@@ -231,10 +235,10 @@ _VBoxManage() {
|
|||||||
|
|
||||||
list=$(VBoxManage list hostonlyifs | \
|
list=$(VBoxManage list hostonlyifs | \
|
||||||
egrep ^Name: | \
|
egrep ^Name: | \
|
||||||
sed 's/Name:\s\+//' | \
|
$VBMC_SED 's/Name:\s\+//' | \
|
||||||
sed 's/\s/\\ /g'| \
|
$VBMC_SED 's/\s/\\ /g'| \
|
||||||
tr '\n' '|' | \
|
tr '\n' '|' | \
|
||||||
sed 's/|$//')
|
$VBMC_SED 's/|$//')
|
||||||
IFS='|' read -ra list <<< "$list"
|
IFS='|' read -ra list <<< "$list"
|
||||||
|
|
||||||
for item in "${list[@]}"
|
for item in "${list[@]}"
|
||||||
@@ -253,8 +257,8 @@ _VBoxManage() {
|
|||||||
awk -F ',' '{print $1}' | \
|
awk -F ',' '{print $1}' | \
|
||||||
awk -F '=' '{print $2}' | \
|
awk -F '=' '{print $2}' | \
|
||||||
tr '\n' '|' | \
|
tr '\n' '|' | \
|
||||||
sed 's/|$//' | \
|
$VBMC_SED 's/|$//' | \
|
||||||
sed 's/\s/\\ /g')
|
$VBMC_SED 's/\s/\\ /g')
|
||||||
IFS='|' read -ra rules <<< "$rules"
|
IFS='|' read -ra rules <<< "$rules"
|
||||||
|
|
||||||
for item in "${rules[@]}"
|
for item in "${rules[@]}"
|
||||||
@@ -295,7 +299,7 @@ _VBoxManage() {
|
|||||||
devs=$(VBoxManage controlvm "${name//\\/}" \
|
devs=$(VBoxManage controlvm "${name//\\/}" \
|
||||||
webcam list | \
|
webcam list | \
|
||||||
tr '\n' ' ' | \
|
tr '\n' ' ' | \
|
||||||
sed 's/|s$//')
|
$VBMC_SED 's/|s$//')
|
||||||
read -ra devs <<< "$devs"
|
read -ra devs <<< "$devs"
|
||||||
|
|
||||||
for item in "${devs[@]}"
|
for item in "${devs[@]}"
|
||||||
@@ -312,7 +316,7 @@ _VBoxManage() {
|
|||||||
devs=$(VBoxManage list webcams | \
|
devs=$(VBoxManage list webcams | \
|
||||||
grep dev | \
|
grep dev | \
|
||||||
tr '\n' ' ' | \
|
tr '\n' ' ' | \
|
||||||
sed 's/|s$//')
|
$VBMC_SED 's/|s$//')
|
||||||
read -ra devs <<< "$devs"
|
read -ra devs <<< "$devs"
|
||||||
|
|
||||||
for item in "${devs[@]}"
|
for item in "${devs[@]}"
|
||||||
@@ -323,7 +327,7 @@ _VBoxManage() {
|
|||||||
|
|
||||||
_list_comp() {
|
_list_comp() {
|
||||||
local list
|
local list
|
||||||
list=$(VBoxManage list | sed -e '1,2d' \
|
list=$(VBoxManage list | $VBMC_SED -e '1,2d' \
|
||||||
-e 's/VBoxManage list //' \
|
-e 's/VBoxManage list //' \
|
||||||
-e 's/[\[\]\|]/ /g' \
|
-e 's/[\[\]\|]/ /g' \
|
||||||
-e 's/|/ /g'|xargs echo)
|
-e 's/|/ /g'|xargs echo)
|
||||||
@@ -338,10 +342,10 @@ _VBoxManage() {
|
|||||||
folders=$(VBoxManage showvminfo ${vm} --machinereadable | \
|
folders=$(VBoxManage showvminfo ${vm} --machinereadable | \
|
||||||
grep SharedFolderName | \
|
grep SharedFolderName | \
|
||||||
awk -F= '{print $2}' | \
|
awk -F= '{print $2}' | \
|
||||||
sed 's/\s/\\ /g'| \
|
$VBMC_SED 's/\s/\\ /g'| \
|
||||||
tr '\n' '|' | \
|
tr '\n' '|' | \
|
||||||
sed 's/|$//' | \
|
$VBMC_SED 's/|$//' | \
|
||||||
sed 's/"//g')
|
$VBMC_SED 's/"//g')
|
||||||
IFS='|' read -ra folders <<< "$folders"
|
IFS='|' read -ra folders <<< "$folders"
|
||||||
|
|
||||||
for item in "${folders[@]}"
|
for item in "${folders[@]}"
|
||||||
@@ -356,10 +360,10 @@ _VBoxManage() {
|
|||||||
|
|
||||||
list=$(VBoxManage list natnets | \
|
list=$(VBoxManage list natnets | \
|
||||||
grep NetworkName: | \
|
grep NetworkName: | \
|
||||||
sed 's/NetworkName:\s\+//' | \
|
$VBMC_SED 's/NetworkName:\s\+//' | \
|
||||||
sed 's/\s/\\ /g'| \
|
$VBMC_SED 's/\s/\\ /g'| \
|
||||||
tr '\n' '|' | \
|
tr '\n' '|' | \
|
||||||
sed 's/|$//')
|
$VBMC_SED 's/|$//')
|
||||||
IFS='|' read -ra list <<< "$list"
|
IFS='|' read -ra list <<< "$list"
|
||||||
|
|
||||||
for item in "${list[@]}"
|
for item in "${list[@]}"
|
||||||
@@ -374,10 +378,10 @@ _VBoxManage() {
|
|||||||
|
|
||||||
list=$(VBoxManage list bridgedifs | \
|
list=$(VBoxManage list bridgedifs | \
|
||||||
egrep ^Name: | \
|
egrep ^Name: | \
|
||||||
sed 's/Name:\s\+//' | \
|
$VBMC_SED 's/Name:\s\+//' | \
|
||||||
sed 's/\s/\\ /g'| \
|
$VBMC_SED 's/\s/\\ /g'| \
|
||||||
tr '\n' '|' | \
|
tr '\n' '|' | \
|
||||||
sed 's/|$//')
|
$VBMC_SED 's/|$//')
|
||||||
IFS='|' read -ra list <<< "$list"
|
IFS='|' read -ra list <<< "$list"
|
||||||
|
|
||||||
for item in "${list[@]}"
|
for item in "${list[@]}"
|
||||||
@@ -392,10 +396,10 @@ _VBoxManage() {
|
|||||||
|
|
||||||
list=$(VBoxManage list intnets| \
|
list=$(VBoxManage list intnets| \
|
||||||
egrep ^Name: | \
|
egrep ^Name: | \
|
||||||
sed 's/Name:\s\+//' | \
|
$VBMC_SED 's/Name:\s\+//' | \
|
||||||
sed 's/\s/\\ /g'| \
|
$VBMC_SED 's/\s/\\ /g'| \
|
||||||
tr '\n' '|' | \
|
tr '\n' '|' | \
|
||||||
sed 's/|$//')
|
$VBMC_SED 's/|$//')
|
||||||
IFS='|' read -ra list <<< "$list"
|
IFS='|' read -ra list <<< "$list"
|
||||||
|
|
||||||
for item in "${list[@]}"
|
for item in "${list[@]}"
|
||||||
@@ -438,10 +442,10 @@ _VBoxManage() {
|
|||||||
|
|
||||||
providers=$(VBoxManage list cloudproviders | \
|
providers=$(VBoxManage list cloudproviders | \
|
||||||
grep "Short Name:" | \
|
grep "Short Name:" | \
|
||||||
sed 's/Short Name:\s\+//' | \
|
$VBMC_SED 's/Short Name:\s\+//' | \
|
||||||
sed 's/\s/\\ /g' | \
|
$VBMC_SED 's/\s/\\ /g' | \
|
||||||
tr '\n' '|' | \
|
tr '\n' '|' | \
|
||||||
sed 's/|$//')
|
$VBMC_SED 's/|$//')
|
||||||
IFS='|' read -ra providers <<< "$providers"
|
IFS='|' read -ra providers <<< "$providers"
|
||||||
|
|
||||||
for item in "${providers[@]}"
|
for item in "${providers[@]}"
|
||||||
@@ -456,10 +460,10 @@ _VBoxManage() {
|
|||||||
|
|
||||||
profiles=$(VBoxManage list cloudprofiles | \
|
profiles=$(VBoxManage list cloudprofiles | \
|
||||||
grep "Name:" | \
|
grep "Name:" | \
|
||||||
sed 's/Name:\s\+//' | \
|
$VBMC_SED 's/Name:\s\+//' | \
|
||||||
sed 's/\s/\\ /g' | \
|
$VBMC_SED 's/\s/\\ /g' | \
|
||||||
tr '\n' '|' | \
|
tr '\n' '|' | \
|
||||||
sed 's/|$//')
|
$VBMC_SED 's/|$//')
|
||||||
IFS='|' read -ra profiles <<< "$profiles"
|
IFS='|' read -ra profiles <<< "$profiles"
|
||||||
|
|
||||||
for item in "${profiles[@]}"
|
for item in "${profiles[@]}"
|
||||||
@@ -482,16 +486,18 @@ _VBoxManage() {
|
|||||||
|
|
||||||
# all possible commands for the VBoxManage
|
# all possible commands for the VBoxManage
|
||||||
opts=$(VBoxManage -q help | \
|
opts=$(VBoxManage -q help | \
|
||||||
egrep -o "^\s\s[a-z]+ " | \
|
grep -E -o "^\s\s[a-z]+ " | \
|
||||||
grep -v VBoxManage | \
|
grep -v VBoxManage | \
|
||||||
awk '{print $1}'| \
|
awk '{print $1}'| \
|
||||||
sort | \
|
sort | \
|
||||||
uniq)
|
uniq)
|
||||||
|
|
||||||
# Add some commands manually, since they are listed differently in
|
# Add commands which are defined as ` VBoxManage commandname ` in a help.
|
||||||
# vboxmanage help.
|
opts="${opts} $(VBoxManage -q help | \
|
||||||
opts="${opts} mediumio debugvm unattended extpack clonevm snapshot
|
grep -E -o '^\s\s[a-zA-Z]+\s[a-z]+' | \
|
||||||
dhcpserver cloudprofile cloud"
|
awk '{print $2}'| \
|
||||||
|
sort | \
|
||||||
|
uniq)"
|
||||||
|
|
||||||
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}) )
|
||||||
@@ -687,14 +693,19 @@ _VBoxManage() {
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
cloud)
|
cloud)
|
||||||
if [[ " ${COMP_WORDS[@]} " != *" --provider"* ||
|
if [ "${prev}" == "cloud" ]; then
|
||||||
|
items=(--provider --profile network)
|
||||||
|
elif [[ " ${COMP_WORDS[@]} " == *" network"* ]]; then
|
||||||
|
items=(update delete info)
|
||||||
|
elif [[ " ${COMP_WORDS[@]} " != *" --provider"* ||
|
||||||
" ${COMP_WORDS[@]} " != *" --profile"* ]]; then
|
" ${COMP_WORDS[@]} " != *" --profile"* ]]; then
|
||||||
items=(--provider --profile)
|
items=(--provider --profile)
|
||||||
else
|
else
|
||||||
[[ " ${COMP_WORDS[@]} " != *" list"* &&
|
[[ " ${COMP_WORDS[@]} " != *" list"* &&
|
||||||
" ${COMP_WORDS[@]} " != *" instance"* &&
|
" ${COMP_WORDS[@]} " != *" instance"* &&
|
||||||
|
" ${COMP_WORDS[@]} " != *" network"* &&
|
||||||
" ${COMP_WORDS[@]} " != *" image"* ]] &&
|
" ${COMP_WORDS[@]} " != *" image"* ]] &&
|
||||||
items=(list instance image)
|
items=(list instance image network)
|
||||||
fi
|
fi
|
||||||
_get_excluded_items "${items[@]}"
|
_get_excluded_items "${items[@]}"
|
||||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||||
@@ -718,7 +729,11 @@ _VBoxManage() {
|
|||||||
COMPREPLY=( $(compgen -W "create info delete import
|
COMPREPLY=( $(compgen -W "create info delete import
|
||||||
export" -- ${cur}) )
|
export" -- ${cur}) )
|
||||||
;;
|
;;
|
||||||
|
network) # TODO: differentiate between setup/create and update/delete/info
|
||||||
|
if [[ " ${COMP_WORDS[@]} " == *" --provider"* ]]; then
|
||||||
|
COMPREPLY=( $(compgen -W "setup create" -- ${cur}) )
|
||||||
|
fi
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
if [[ " ${COMP_WORDS[@]} " == *" list images"* ]]; then
|
if [[ " ${COMP_WORDS[@]} " == *" list images"* ]]; then
|
||||||
|
|
||||||
@@ -728,8 +743,9 @@ _VBoxManage() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ " ${COMP_WORDS[@]} " == *" instance create"* ]]; then
|
if [[ " ${COMP_WORDS[@]} " == *" instance create"* ]]; then
|
||||||
items=(--domain-name --display-name --shape --subnet --publicip
|
items=( --domain-name --display-name --shape --subnet
|
||||||
--boot-disk-size --privateip --public-ssh-key --launch-mode)
|
--publicip --boot-disk-size --privateip --public-ssh-key
|
||||||
|
--launch-mode --cloud-init-script-path )
|
||||||
[[ " ${COMP_WORDS[@]} " != *" --image-id"* &&
|
[[ " ${COMP_WORDS[@]} " != *" --image-id"* &&
|
||||||
" ${COMP_WORDS[@]} " != *" --boot-volume-id"* ]] &&
|
" ${COMP_WORDS[@]} " != *" --boot-volume-id"* ]] &&
|
||||||
items+=(--image-id --boot-volume-id)
|
items+=(--image-id --boot-volume-id)
|
||||||
@@ -772,6 +788,34 @@ _VBoxManage() {
|
|||||||
COMPREPLY=( $(compgen -W "--id --display-name --bucket-name
|
COMPREPLY=( $(compgen -W "--id --display-name --bucket-name
|
||||||
--object-name" -- ${cur}) )
|
--object-name" -- ${cur}) )
|
||||||
fi
|
fi
|
||||||
|
if [[ " ${COMP_WORDS[@]} " == *" network setup"* ]]; then
|
||||||
|
items=( --local-gateway-iso --gateway-os-name
|
||||||
|
--gateway-os-version --gateway-shape --tunnel-network-name
|
||||||
|
--tunnel-network-range --guest-additions-iso --proxy
|
||||||
|
--compartment-id )
|
||||||
|
_get_excluded_items "${items[@]}"
|
||||||
|
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||||
|
fi
|
||||||
|
if [[ " ${COMP_WORDS[@]} " == *" network create"* ]]; then
|
||||||
|
items=( --name --network-id )
|
||||||
|
[[ " ${COMP_WORDS[@]} " != *" --enable"* &&
|
||||||
|
" ${COMP_WORDS[@]} " != *" --disable"* ]] &&
|
||||||
|
items+=(--enable --disable)
|
||||||
|
_get_excluded_items "${items[@]}"
|
||||||
|
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||||
|
fi
|
||||||
|
if [[ " ${COMP_WORDS[@]} " == *" network update"* ]]; then
|
||||||
|
items=( --name --network-id )
|
||||||
|
[[ " ${COMP_WORDS[@]} " != *" --enable"* &&
|
||||||
|
" ${COMP_WORDS[@]} " != *" --disable"* ]] &&
|
||||||
|
items+=(--enable --disable)
|
||||||
|
_get_excluded_items "${items[@]}"
|
||||||
|
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||||
|
fi
|
||||||
|
if [[ " ${COMP_WORDS[@]} " == *" network info"* ||
|
||||||
|
" ${COMP_WORDS[@]} " == *" network delete"* ]]; then
|
||||||
|
COMPREPLY=( $(compgen -W "--name" -- ${cur}) )
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
controlvm)
|
controlvm)
|
||||||
@@ -1226,7 +1270,7 @@ _VBoxManage() {
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
"export")
|
"export")
|
||||||
items=( --manifest --iso --options --vsys --cloud )
|
items=( --manifest --options --vsys --cloud --cloudinitscriptpath )
|
||||||
if [[ ${prev} == ${cmd} ]]; then
|
if [[ ${prev} == ${cmd} ]]; then
|
||||||
_vms_comp vms
|
_vms_comp vms
|
||||||
elif [[ ${prev} == "--eulafile" ]]; then
|
elif [[ ${prev} == "--eulafile" ]]; then
|
||||||
@@ -1252,7 +1296,7 @@ _VBoxManage() {
|
|||||||
items+=(--vmname --cloudprofile --cloudshape --clouddomain
|
items+=(--vmname --cloudprofile --cloudshape --clouddomain
|
||||||
--clouddisksize --cloudbucket --cloudocivcn --cloudocisubnet
|
--clouddisksize --cloudbucket --cloudocivcn --cloudocisubnet
|
||||||
--cloudkeepobject --cloudlaunchinstance --cloudpublicip
|
--cloudkeepobject --cloudlaunchinstance --cloudpublicip
|
||||||
--cloudprivateip --cloudlaunchmode)
|
--cloudprivateip --cloudlaunchmode --cloudinitscriptpath )
|
||||||
_get_excluded_items "${items[@]}"
|
_get_excluded_items "${items[@]}"
|
||||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||||
|
|
||||||
@@ -1277,7 +1321,7 @@ _VBoxManage() {
|
|||||||
if [[ " ${items[@]} " == *" $subcommand "* ]]; then
|
if [[ " ${items[@]} " == *" $subcommand "* ]]; then
|
||||||
case "${subcommand}" in
|
case "${subcommand}" in
|
||||||
install)
|
install)
|
||||||
_get_excluded_items "--replace"
|
_get_excluded_items "--replace --accept-license"
|
||||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||||
;;
|
;;
|
||||||
uninstall)
|
uninstall)
|
||||||
@@ -2300,7 +2344,7 @@ _VBoxManage() {
|
|||||||
case "${subcommand}" in
|
case "${subcommand}" in
|
||||||
add)
|
add)
|
||||||
items=(--name --hostpath --transient --readonly
|
items=(--name --hostpath --transient --readonly
|
||||||
--automount)
|
--automount --auto-mount-point)
|
||||||
_get_excluded_items "${items[@]}"
|
_get_excluded_items "${items[@]}"
|
||||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||||
;;
|
;;
|
||||||
|
|||||||
Reference in New Issue
Block a user