mirror of
https://github.com/gryf/vboxmanage-bash-completion.git
synced 2026-03-26 03:33:31 +01:00
Compare commits
12 Commits
8dd76f3295
...
7.0.20
| Author | SHA1 | Date | |
|---|---|---|---|
| cd90fc60bd | |||
| 28553da42d | |||
| 3efab392c1 | |||
| b0352554bb | |||
|
|
95088850b6 | ||
| 3404afa441 | |||
| ab6d9f7cd9 | |||
| 3bb795a1e3 | |||
| 468a0a4c32 | |||
| 59ffe61fd6 | |||
| 7c13b0ab6b | |||
| 67ac4d655f |
@@ -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
|
||||
6.1.38, and should contain all commands and their options.
|
||||
7.0.20, 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:
|
||||
|
||||
434
VBoxManage
434
VBoxManage
@@ -1,10 +1,9 @@
|
||||
# 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.1.38
|
||||
# Version: 7.0.20
|
||||
|
||||
|
||||
_VBoxManage() {
|
||||
@@ -41,7 +40,7 @@ _VBoxManage() {
|
||||
|
||||
result=""
|
||||
for i in $@; do
|
||||
[[ " ${COMP_WORDS[@]} " == *" $i "* ]] && continue
|
||||
[[ " ${COMP_WORDS[*]} " == *" $i "* ]] && continue
|
||||
result="$result $i"
|
||||
done
|
||||
}
|
||||
@@ -51,7 +50,7 @@ _VBoxManage() {
|
||||
|
||||
result=""
|
||||
for i in $@; do
|
||||
if [[ " ${COMP_WORDS[@]} " == *" $i "* ]]; then
|
||||
if [[ " ${COMP_WORDS[*]} " == *" $i "* ]]; then
|
||||
result="ITIS"
|
||||
break
|
||||
fi
|
||||
@@ -164,8 +163,8 @@ _VBoxManage() {
|
||||
compopt -o filenames
|
||||
|
||||
vms=$(VBoxManage list vms -l | \
|
||||
egrep '^Name|State' | \
|
||||
egrep -B1 'State:\s+saved' | \
|
||||
grep -E '^Name|State' | \
|
||||
grep -E -B1 'State:\s+saved' | \
|
||||
grep Name |$VBMC_SED 's/Name:\s\+//' | \
|
||||
tr '\n' '|' | \
|
||||
$VBMC_SED 's/|$//' | \
|
||||
@@ -199,7 +198,7 @@ _VBoxManage() {
|
||||
local item
|
||||
|
||||
list=$(VBoxManage list ostypes | \
|
||||
egrep ^ID: | \
|
||||
grep -E ^ID: | \
|
||||
$VBMC_SED 's/ID:\s\+//' | \
|
||||
tr '\n' '|' | \
|
||||
$VBMC_SED 's/|$//')
|
||||
@@ -234,7 +233,7 @@ _VBoxManage() {
|
||||
local item
|
||||
|
||||
list=$(VBoxManage list hostonlyifs | \
|
||||
egrep ^Name: | \
|
||||
grep -E ^Name: | \
|
||||
$VBMC_SED 's/Name:\s\+//' | \
|
||||
$VBMC_SED 's/\s/\\ /g'| \
|
||||
tr '\n' '|' | \
|
||||
@@ -377,7 +376,7 @@ _VBoxManage() {
|
||||
local item
|
||||
|
||||
list=$(VBoxManage list bridgedifs | \
|
||||
egrep ^Name: | \
|
||||
grep -E ^Name: | \
|
||||
$VBMC_SED 's/Name:\s\+//' | \
|
||||
$VBMC_SED 's/\s/\\ /g'| \
|
||||
tr '\n' '|' | \
|
||||
@@ -395,7 +394,7 @@ _VBoxManage() {
|
||||
local item
|
||||
|
||||
list=$(VBoxManage list intnets| \
|
||||
egrep ^Name: | \
|
||||
grep -E ^Name: | \
|
||||
$VBMC_SED 's/Name:\s\+//' | \
|
||||
$VBMC_SED 's/\s/\\ /g'| \
|
||||
tr '\n' '|' | \
|
||||
@@ -677,11 +676,12 @@ _VBoxManage() {
|
||||
_cloudprofiles_comp
|
||||
;;
|
||||
list)
|
||||
COMPREPLY=( $(compgen -W "instances images" -- ${cur}) )
|
||||
COMPREPLY=( $(compgen -W "instances images vnicattachments"
|
||||
-- ${cur}) )
|
||||
;;
|
||||
instance)
|
||||
COMPREPLY=( $(compgen -W "create info terminate start
|
||||
pause" -- ${cur}) )
|
||||
pause reset" -- ${cur}) )
|
||||
;;
|
||||
image)
|
||||
COMPREPLY=( $(compgen -W "create info delete import
|
||||
@@ -692,6 +692,13 @@ _VBoxManage() {
|
||||
COMPREPLY=( $(compgen -W "setup create" -- ${cur}) )
|
||||
fi
|
||||
;;
|
||||
reset)
|
||||
COMPREPLY=( $(compgen -W "--id" -- ${cur}) )
|
||||
;;
|
||||
vnicattachments)
|
||||
COMPREPLY=( $(compgen -W "--compartment-id --filter"
|
||||
-- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
if [[ " ${COMP_WORDS[*]} " == *" list images"* ||
|
||||
" ${COMP_WORDS[*]} " == *" list instances"* ]]; then
|
||||
@@ -819,23 +826,21 @@ _VBoxManage() {
|
||||
changeuartmode1 changeuartmode2 clipboard cpuexecutioncap
|
||||
draganddrop guestmemoryballoon keyboardputfile
|
||||
keyboardputscancode keyboardputstring natpf1 natpf2 natpf3
|
||||
natpf4 natpf5 natpf6 natpf7 natpf8 natpf9 natpf1delete
|
||||
natpf2delete natpf3delete natpf4delete natpf5delete natpf6delete
|
||||
natpf7delete natpf8delete nic1 nic2 nic3 nic4 nic5 nic6 nic7
|
||||
nic8 nicpromisc1 nicpromisc2 nicpromisc3 nicpromisc4 nicpromisc5
|
||||
nicpromisc6 nicpromisc7 nicpromisc8 nicproperty1 nicproperty2
|
||||
nicproperty3 nicproperty4 nicproperty5 nicproperty6 nicproperty7
|
||||
nicproperty8 nictrace1 nictrace2 nictrace3 nictrace4 nictrace5
|
||||
nictrace6 nictrace7 nictrace8 nictracefile1 nictracefile2
|
||||
nictracefile3 nictracefile4 nictracefile5 nictracefile6
|
||||
nictracefile7 nictracefile8 pause plugcpu poweroff reboot
|
||||
recording removeallencpasswords removeencpassword reset resume
|
||||
savestate screenshotpng setcredentials setlinkstate1
|
||||
setlinkstate2 setlinkstate3 setlinkstate4 setlinkstate5
|
||||
setlinkstate6 setlinkstate7 setlinkstate8 setscreenlayout
|
||||
setvideomodehint shutdown teleport unplugcpu usbattach usbdetach
|
||||
vm-process-priority vrde vrdeport vrdeproperty
|
||||
vrdevideochannelquality webcam )
|
||||
natpf4 natpf5 natpf6 natpf7 natpf8 natpf9 nic1 nic2 nic3 nic4
|
||||
nic5 nic6 nic7 nic8 nicpromisc1 nicpromisc2 nicpromisc3
|
||||
nicpromisc4 nicpromisc5 nicpromisc6 nicpromisc7 nicpromisc8
|
||||
nicproperty1 nicproperty2 nicproperty3 nicproperty4 nicproperty5
|
||||
nicproperty6 nicproperty7 nicproperty8 nictrace1 nictrace2
|
||||
nictrace3 nictrace4 nictrace5 nictrace6 nictrace7 nictrace8
|
||||
nictracefile1 nictracefile2 nictracefile3 nictracefile4
|
||||
nictracefile5 nictracefile6 nictracefile7 nictracefile8 pause
|
||||
plugcpu poweroff reboot recording removeallencpasswords
|
||||
removeencpassword reset resume savestate screenshotpng
|
||||
setcredentials setlinkstate1 setlinkstate2 setlinkstate3
|
||||
setlinkstate4 setlinkstate5 setlinkstate6 setlinkstate7
|
||||
setlinkstate8 setscreenlayout setvideomodehint shutdown teleport
|
||||
unplugcpu usbattach usbdetach vm-process-priority vrde vrdeport
|
||||
vrdeproperty vrdevideochannelquality webcam )
|
||||
|
||||
_find_item_name 2
|
||||
subcommand=${COMP_WORDS[$((index+1))]}
|
||||
@@ -932,9 +937,8 @@ _VBoxManage() {
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
changeuartmode[1-2])
|
||||
tmp=(disconnected serverpipe-name clientpipe-name
|
||||
tcpserverport tcpclienthostname:port filefilename
|
||||
device-name)
|
||||
tmp=(disconnected server client tcpserver tcpclient
|
||||
file device-name)
|
||||
_get_excluded_items "${tmp[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
@@ -1041,8 +1045,8 @@ _VBoxManage() {
|
||||
;;
|
||||
|
||||
createvm)
|
||||
items=( --basefolder --ciphercipher --default --group --name --ostype
|
||||
--password-idpassword-id --passwordfile --register --uuid )
|
||||
items=( --basefolder --cipher --default --groups --name --ostype
|
||||
--password-id --password --register --uuid )
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
COMPREPLY=( $(compgen -W "${items[*]}" -- ${cur}) )
|
||||
else
|
||||
@@ -1050,7 +1054,7 @@ _VBoxManage() {
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
|
||||
case "${prev}" in
|
||||
--group)
|
||||
--groups)
|
||||
COMPREPLY=()
|
||||
_group_comp
|
||||
;;
|
||||
@@ -1061,7 +1065,7 @@ _VBoxManage() {
|
||||
--basefolder)
|
||||
COMPREPLY=( $(compgen -o dirnames -- ${cur}) )
|
||||
;;
|
||||
--passwordfile)
|
||||
--password)
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
@@ -1302,7 +1306,7 @@ _VBoxManage() {
|
||||
if [[ " ${items[*]} " == *" $subcommand "* ]]; then
|
||||
case "${subcommand}" in
|
||||
addpassword)
|
||||
items=( --passwordfile --password-id )
|
||||
items=( --password --password-id )
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
@@ -1313,15 +1317,15 @@ _VBoxManage() {
|
||||
COMPREPLY=()
|
||||
;;
|
||||
setencryption)
|
||||
items=( --old-passwordfile --ciphercipher-identifier
|
||||
--new-passwordfile --new-password-id --force )
|
||||
items=( --old-password --cipher
|
||||
--new-password --new-password-id --force )
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
else
|
||||
case "$prev" in
|
||||
--new-passwordfile|--old-passwordfile|--passwordfile)
|
||||
--new-password|--old-password|--password)
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
;;
|
||||
*)
|
||||
@@ -1417,203 +1421,148 @@ _VBoxManage() {
|
||||
;;
|
||||
|
||||
guestcontrol)
|
||||
local items=(run start copyfrom copyto mkdir createdir
|
||||
createdirectory rmdir removedir removedirectory removefile rm mv
|
||||
move ren rename mktemp createtemp createtemporary stat list
|
||||
closeprocess closesession updatega updateguestadditions
|
||||
updateadditions watch)
|
||||
local items=( run start copyfrom copyto mkdir rmdir rm mv mktemp
|
||||
stat list closeprocess closesession updatega watch )
|
||||
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
_vms_comp runningvms
|
||||
else
|
||||
_find_item_name 2
|
||||
subcommand=${COMP_WORDS[$((index+1))]}
|
||||
if [[ " ${items[@]} " == *" $subcommand "* ]]; then
|
||||
if [[ " ${items[*]} " == *" $subcommand "* ]]; then
|
||||
case "${subcommand}" in
|
||||
run)
|
||||
items=(--exe --timeout --unquoted-args
|
||||
--ignore-operhaned-processes --profile
|
||||
--dos2unix --unix2dos --username --domain --)
|
||||
items=( --arg0 --domain --dos2unix --exe
|
||||
--ignore-operhaned-processes --profile --putenv
|
||||
--quiet --timeout --unix2dos --unquoted-args
|
||||
--username --verbose -- )
|
||||
|
||||
[[ " ${COMP_WORDS[@]} " != *" --password "* ||
|
||||
" ${COMP_WORDS[@]} " != *" --passwordfile "* ]] &&
|
||||
[[ " ${COMP_WORDS[*]} " != *" --password "* ||
|
||||
" ${COMP_WORDS[*]} " != *" --passwordfile "* ]] &&
|
||||
items+=(--passwordfile --password)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --putenv "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -E "* ]] &&
|
||||
items+=(--putenv -E)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --no-wait-stdout "* &&
|
||||
" ${COMP_WORDS[@]} " != *" --wait-stdout "* ]] &&
|
||||
[[ " ${COMP_WORDS[*]} " != *" --no-wait-stdout "* &&
|
||||
" ${COMP_WORDS[*]} " != *" --wait-stdout "* ]] &&
|
||||
items+=(--no-wait-stdout --wait-stdout)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --no-wait-stderr"* &&
|
||||
" ${COMP_WORDS[@]} " != *" --wait-stderr "* ]] &&
|
||||
[[ " ${COMP_WORDS[*]} " != *" --no-wait-stderr"* &&
|
||||
" ${COMP_WORDS[*]} " != *" --wait-stderr "* ]] &&
|
||||
items+=(--no-wait-stderr --wait-stderr)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --verbose "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -v "* ]] &&
|
||||
items+=(--verbose -v)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --quiet "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -q "* ]] &&
|
||||
items+=(--quiet -q)
|
||||
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
|
||||
start)
|
||||
items=(--exe --timeout --unquoted-args
|
||||
--ignore-operhaned-processes --profile
|
||||
--username --domain --passwordfile --password --)
|
||||
items=( --arg0 --domain --exe
|
||||
--ignore-orphaned-processes --profile --putenv
|
||||
--quiet --timeout --unquoted-args --username
|
||||
--verbose -- )
|
||||
|
||||
[[ " ${COMP_WORDS[@]} " != *" --password "* ||
|
||||
" ${COMP_WORDS[@]} " != *" --passwordfile "* ]] &&
|
||||
[[ " ${COMP_WORDS[*]} " != *" --password "* ||
|
||||
" ${COMP_WORDS[*]} " != *" --passwordfile "* ]] &&
|
||||
items+=(--passwordfile --password)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --verbose "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -v "* ]] &&
|
||||
items+=(--verbose -v)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --quiet "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -q "* ]] &&
|
||||
items+=(--quiet -q)
|
||||
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
|
||||
copyfrom|copyto)
|
||||
items=(--follow --target-directory --username
|
||||
--domain)
|
||||
items=( --dereference --domain --quiet --no-replace
|
||||
--recursive --target-directory --update
|
||||
--username --verbose )
|
||||
|
||||
[[ " ${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 "* ]] &&
|
||||
items+=(--verbose -v)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --quiet "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -q "* ]] &&
|
||||
items+=(--quiet -q)
|
||||
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
|
||||
createdirectory|createdir|mkdir)
|
||||
items=(--parents --mode --username --domain)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --password "* ||
|
||||
" ${COMP_WORDS[@]} " != *" --passwordfile "* ]] &&
|
||||
mkdir)
|
||||
items=( --domain --mode --parents --quiet
|
||||
--username --verbose )
|
||||
[[ " ${COMP_WORDS[*]} " != *" --password "* ||
|
||||
" ${COMP_WORDS[*]} " != *" --passwordfile "* ]] &&
|
||||
items+=(--passwordfile --password)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --verbose "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -v "* ]] &&
|
||||
items+=(--verbose -v)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --quiet "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -q "* ]] &&
|
||||
items+=(--quiet -q)
|
||||
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
|
||||
removedir|removedirectory|rmdir)
|
||||
items=(--username --domain)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --password "* &&
|
||||
" ${COMP_WORDS[@]} " != *" --passwordfile "* ]] &&
|
||||
rmdir)
|
||||
items=( --domain --quiet --recursive --username
|
||||
--verbose )
|
||||
[[ " ${COMP_WORDS[*]} " != *" --password "* &&
|
||||
" ${COMP_WORDS[*]} " != *" --passwordfile "* ]] &&
|
||||
items+=(--passwordfile --password)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --recursive "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -R "* ]] &&
|
||||
items+=(--recursive -R)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --verbose "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -v "* ]] &&
|
||||
items+=(--verbose -v)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --quiet "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -q "* ]] &&
|
||||
items+=(--quiet -q)
|
||||
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
|
||||
removefile|rm)
|
||||
items=(--username --domain)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --force "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -f "* ]] &&
|
||||
items+=(--force -f)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --password "* &&
|
||||
" ${COMP_WORDS[@]} " != *" --passwordfile "* ]] &&
|
||||
rm)
|
||||
items=( --domain --force --quiet --username
|
||||
--verbose )
|
||||
[[ " ${COMP_WORDS[*]} " != *" --password "* &&
|
||||
" ${COMP_WORDS[*]} " != *" --passwordfile "* ]] &&
|
||||
items+=(--passwordfile --password)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --verbose "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -v "* ]] &&
|
||||
items+=(--verbose -v)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --quiet "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -q "* ]] &&
|
||||
items+=(--quiet -q)
|
||||
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
|
||||
rename|ren|move|mv)
|
||||
items=(--username --domain)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --password "* &&
|
||||
" ${COMP_WORDS[@]} " != *" --passwordfile "* ]] &&
|
||||
mv)
|
||||
items=( --domain --quiet --username --verbose )
|
||||
[[ " ${COMP_WORDS[*]} " != *" --password "* &&
|
||||
" ${COMP_WORDS[*]} " != *" --passwordfile "* ]] &&
|
||||
items+=(--passwordfile --password)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --verbose "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -v "* ]] &&
|
||||
items+=(--verbose -v)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --quiet "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -q "* ]] &&
|
||||
items+=(--quiet -q)
|
||||
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
|
||||
createtemporary|createtemp|mktemp)
|
||||
items=(--username --domain --secure --tmpdir --mode)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --password "* &&
|
||||
" ${COMP_WORDS[@]} " != *" --passwordfile "* ]] &&
|
||||
mktemp)
|
||||
items=( --directory --domain --mode --quiet --secure
|
||||
--tmpdir --username --verbose )
|
||||
[[ " ${COMP_WORDS[*]} " != *" --password "* &&
|
||||
" ${COMP_WORDS[*]} " != *" --passwordfile "* ]] &&
|
||||
items+=(--passwordfile --password)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --verbose "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -v "* ]] &&
|
||||
items+=(--verbose -v)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --quiet "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -q "* ]] &&
|
||||
items+=(--quiet -q)
|
||||
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
|
||||
stat)
|
||||
if [[ "${cur}" == "stat" ]]; then
|
||||
COMPREPLY=( $(compgen -- ${cur}) )
|
||||
else
|
||||
items=( --domain --quiet --username --verbose )
|
||||
[[ " ${COMP_WORDS[*]} " != *" --password "* &&
|
||||
" ${COMP_WORDS[*]} " != *" --passwordfile "* ]] &&
|
||||
items+=(--passwordfile --password)
|
||||
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
fi
|
||||
;;
|
||||
|
||||
list)
|
||||
items=()
|
||||
[[ " ${COMP_WORDS[@]} " != *" all "* &&
|
||||
" ${COMP_WORDS[@]} " != *" sessions "* &&
|
||||
" ${COMP_WORDS[@]} " != *" processes "* &&
|
||||
" ${COMP_WORDS[@]} " != *" files "* ]] &&
|
||||
items=( --quiet --verbose )
|
||||
[[ " ${COMP_WORDS[*]} " != *" all "* &&
|
||||
" ${COMP_WORDS[*]} " != *" sessions "* &&
|
||||
" ${COMP_WORDS[*]} " != *" processes "* &&
|
||||
" ${COMP_WORDS[*]} " != *" files "* ]] &&
|
||||
items+=(all sessions processes files)
|
||||
|
||||
[[ " ${COMP_WORDS[@]} " != *" --verbose "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -v "* ]] &&
|
||||
items+=(--verbose -v)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --quiet "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -q "* ]] &&
|
||||
items+=(--quiet -q)
|
||||
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
|
||||
closeprocess)
|
||||
items=()
|
||||
[[ " ${COMP_WORDS[@]} " != *" --verbose "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -v "* ]] &&
|
||||
items+=(--verbose -v)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --quiet "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -q "* ]] &&
|
||||
items+=(--quiet -q)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --session-id "* ]] &&
|
||||
items=( --quiet --verbose )
|
||||
[[ " ${COMP_WORDS[*]} " != *" --session-id "* ]] &&
|
||||
items+=(--session-name)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --session-name "* ]] &&
|
||||
[[ " ${COMP_WORDS[*]} " != *" --session-name "* ]] &&
|
||||
items+=(--session-id)
|
||||
|
||||
_get_excluded_items "${items[@]}"
|
||||
@@ -1621,97 +1570,31 @@ _VBoxManage() {
|
||||
;;
|
||||
|
||||
closesession)
|
||||
items=()
|
||||
[[ " ${COMP_WORDS[@]} " != *" --verbose "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -v "* ]] &&
|
||||
items+=(--verbose -v)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --quiet "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -q "* ]] &&
|
||||
items+=(--quiet -q)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --session-id "* &&
|
||||
" ${COMP_WORDS[@]} " != *" --session-name "* &&
|
||||
" ${COMP_WORDS[@]} " != *" --all "* ]] &&
|
||||
items=( --quiet --verbose )
|
||||
[[ " ${COMP_WORDS[*]} " != *" --session-id "* &&
|
||||
" ${COMP_WORDS[*]} " != *" --session-name "* &&
|
||||
" ${COMP_WORDS[*]} " != *" --all "* ]] &&
|
||||
items+=(--session-id --session-name --all)
|
||||
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
|
||||
process)
|
||||
if [[ " ${COMP_WORDS[@]} " == *" process kill "* ]];
|
||||
then
|
||||
items=(--verbose)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --session-name "* &&
|
||||
" ${COMP_WORDS[@]} " != *" --session-id "* ]] &&
|
||||
items+=(--session-id --session-name)
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
else
|
||||
_get_excluded_items "kill"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
fi
|
||||
;;
|
||||
|
||||
stat)
|
||||
if [[ "${cur}" == "stat" ]]; then
|
||||
COMPREPLY=( $(compgen -- ${cur}) )
|
||||
else
|
||||
items=(--username --domain --verbose)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --password "* &&
|
||||
" ${COMP_WORDS[@]} " != *" --passwordfile "* ]] &&
|
||||
items+=(--passwordfile --password)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --verbose "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -v "* ]] &&
|
||||
items+=(--verbose -v)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --quiet "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -q "* ]] &&
|
||||
items+=(--quiet -q)
|
||||
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
fi
|
||||
;;
|
||||
|
||||
updatega|updateguestadditions|updateadditions)
|
||||
items=(--source --wait-start)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --verbose "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -v "* ]] &&
|
||||
items+=(--verbose -v)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --quiet "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -q "* ]] &&
|
||||
items+=(--quiet -q)
|
||||
|
||||
updatega)
|
||||
items=( --quiet --verbose --source --wait-start )
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
|
||||
watch)
|
||||
items=()
|
||||
[[ " ${COMP_WORDS[@]} " != *" --verbose "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -v "* ]] &&
|
||||
items+=(--verbose -v)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --quiet "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -q "* ]] &&
|
||||
items+=(--quiet -q)
|
||||
|
||||
_get_excluded_items "--verbose"
|
||||
items=( --quiet --verbose )
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
|
||||
case "${prev}" in
|
||||
close)
|
||||
items=(--verbose)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --session-name "* &&
|
||||
" ${COMP_WORDS[@]} " != *" --session-id "* &&
|
||||
" ${COMP_WORDS[@]} " != *" --all "* ]] &&
|
||||
items+=(--session-id --session-name --all)
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
--image)
|
||||
COMPREPLY=( $(compgen -- ${cur}) )
|
||||
;;
|
||||
--target-directory|--tmpdir)
|
||||
COMPREPLY=( $(compgen -o dirnames -- ${cur}) )
|
||||
;;
|
||||
@@ -1777,18 +1660,18 @@ _VBoxManage() {
|
||||
esac
|
||||
|
||||
if [[ ${#COMPREPLY[@]} -eq 0 && \
|
||||
" ${items[@]} " == *" $subcommand "* ]]; then
|
||||
" ${items[*]} " == *" $subcommand "* ]]; then
|
||||
case "${subcommand}" in
|
||||
ipconfig)
|
||||
items=(--dhcp --ip --ipv6 --netmask --netmasklengthv6)
|
||||
[[ " ${COMP_WORDS[@]} " == *" --dhcp "* ]] && items=()
|
||||
[[ " ${COMP_WORDS[@]} " == *" --ip "* ]] &&
|
||||
[[ " ${COMP_WORDS[*]} " == *" --dhcp "* ]] && items=()
|
||||
[[ " ${COMP_WORDS[*]} " == *" --ip "* ]] &&
|
||||
items=(--netmask)
|
||||
[[ " ${COMP_WORDS[@]} " == *" --netmask "* ]] &&
|
||||
[[ " ${COMP_WORDS[*]} " == *" --netmask "* ]] &&
|
||||
items=(--ip)
|
||||
[[ " ${COMP_WORDS[@]} " == *" --ipv6 "* ]] &&
|
||||
[[ " ${COMP_WORDS[*]} " == *" --ipv6 "* ]] &&
|
||||
items=(--netmasklengthv6)
|
||||
[[ " ${COMP_WORDS[@]} " == *" --netmasklengthv6 "* ]] &&
|
||||
[[ " ${COMP_WORDS[*]} " == *" --netmasklengthv6 "* ]] &&
|
||||
items=(--ipv6)
|
||||
|
||||
_get_excluded_items "${items[@]}"
|
||||
@@ -1843,7 +1726,7 @@ _VBoxManage() {
|
||||
COMPREPLY=( $(compgen -o dirnames -- ${cur}) )
|
||||
;;
|
||||
|
||||
--eula)=
|
||||
--eula)
|
||||
COMPREPLY=( $(compgen -W "show accept" -- ${cur}) )
|
||||
;;
|
||||
--settingsfile)
|
||||
@@ -1924,9 +1807,9 @@ _VBoxManage() {
|
||||
;;
|
||||
|
||||
metrics)
|
||||
items=(list setup query enable disable collect)
|
||||
items=( collect disable enable list query setup )
|
||||
subcommand=${COMP_WORDS[2]}
|
||||
if [[ " ${items[@]} " == *" $subcommand "* ]]; then
|
||||
if [[ " ${items[*]} " == *" $subcommand "* ]]; then
|
||||
case "${subcommand}" in
|
||||
list|query)
|
||||
if [[ "${subcommand}" == "${prev}" ]]; then
|
||||
@@ -1995,7 +1878,7 @@ _VBoxManage() {
|
||||
*)
|
||||
_find_item_name 2
|
||||
items=( --autoreset --compact --description --move
|
||||
--property --setlocation --type )
|
||||
--property --property-file --setlocation --type )
|
||||
[[ " ${COMP_WORDS[*]} " != *" --resize "* &&
|
||||
" ${COMP_WORDS[*]} " != *" --resizebyte"* ]] &&
|
||||
items+=( --resizebyte --resize )
|
||||
@@ -2013,7 +1896,7 @@ _VBoxManage() {
|
||||
--move)
|
||||
COMPREPLY=( $(compgen -o dirnames -- ${cur}) )
|
||||
;;
|
||||
--setlocation)
|
||||
--setlocation|--property-file)
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
@@ -2024,7 +1907,7 @@ _VBoxManage() {
|
||||
|
||||
modifynvram)
|
||||
items=( changevar deletevar enrollmssignatures enrollorclpk
|
||||
enrollpk inituefivarstore listvars queryvar )
|
||||
enrollpk enrollmok inituefivarstore listvars queryvar )
|
||||
# _get_excluded_items "${items[@]}"
|
||||
# COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
|
||||
@@ -2045,6 +1928,15 @@ _VBoxManage() {
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
fi
|
||||
;;
|
||||
enrollmok)
|
||||
if [ "${prev}" = "--mok" ]; then
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
else
|
||||
items=( --mok --owner-uuid )
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
fi
|
||||
;;
|
||||
queryvar|changevar)
|
||||
if [ "${prev}" = "--filename" ]; then
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
@@ -2316,9 +2208,9 @@ _VBoxManage() {
|
||||
;;
|
||||
|
||||
--uart-mode[1-2])
|
||||
COMPREPLY=( $(compgen -W "disconnected serverpipe
|
||||
clientpipe tcpserverport tcpclienthostname:port
|
||||
filefilename device-name" -- ${cur}) )
|
||||
COMPREPLY=( $(compgen -W "disconnected server
|
||||
client tcpserver tcpclient
|
||||
file device-name" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--uart-type[1-2])
|
||||
@@ -2460,20 +2352,20 @@ _VBoxManage() {
|
||||
;;
|
||||
|
||||
natnetwork)
|
||||
items=(add remove modify start stop list)
|
||||
items=( add list modify remove start stop )
|
||||
subcommand=${COMP_WORDS[2]}
|
||||
if [[ "${prev}" == "--netname" ]]; then
|
||||
_natnet_comp
|
||||
elif [[ "${prev}" == "--dhcp" ]]; then
|
||||
elif [[ "${prev}" == "--dhcp" || "${prev}" == "--ipv6" ]]; then
|
||||
COMPREPLY=( $(compgen -W "on off" -- ${cur}) )
|
||||
elif [[ " ${items[@]} " == *" $subcommand "* ]]; then
|
||||
elif [[ " ${items[*]} " == *" $subcommand "* ]]; then
|
||||
case "${subcommand}" in
|
||||
add|modify)
|
||||
items=(--netname --network --dhcp --port-forward-4
|
||||
--loopback-4 --ipv6 --port-forward-6 --loopback-6)
|
||||
|
||||
[[ " ${COMP_WORDS[@]} " != *" --enable"* &&
|
||||
" ${COMP_WORDS[@]} " != *" --disable"* ]] &&
|
||||
[[ " ${COMP_WORDS[*]} " != *" --enable"* &&
|
||||
" ${COMP_WORDS[*]} " != *" --disable"* ]] &&
|
||||
items+=(--enable --disable)
|
||||
|
||||
_get_excluded_items "${items[@]}"
|
||||
@@ -2499,10 +2391,10 @@ _VBoxManage() {
|
||||
[[ ${#COMPREPLY[@]} = 1 && "${COMPREPLY[0]}" != *".vbox" ]] && \
|
||||
COMPREPLY[0]="${COMPREPLY[0]}/"
|
||||
else
|
||||
if [[ $prev == "--passwordfile" ]]; then
|
||||
if [[ $prev == "--password" ]]; then
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
else
|
||||
local items=( --passwordfile )
|
||||
local items=( --password )
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
fi
|
||||
@@ -2617,12 +2509,12 @@ _VBoxManage() {
|
||||
_vms_comp vms
|
||||
else
|
||||
local items=( --details --machinereadable --log --password-id
|
||||
--password --password-idid --passwordfile )
|
||||
--password )
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
|
||||
case "${prev}" in
|
||||
--log|--passwordfile)
|
||||
--log|--password)
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
@@ -2673,7 +2565,7 @@ _VBoxManage() {
|
||||
else
|
||||
_find_item_name 2
|
||||
subcommand=${COMP_WORDS[$((index+1))]}
|
||||
if [[ " ${items[@]} " == *" $subcommand "* ]]; then
|
||||
if [[ " ${items[*]} " == *" $subcommand "* ]]; then
|
||||
case "${subcommand}" in
|
||||
take)
|
||||
items=(--description --live --uniquename)
|
||||
@@ -2723,10 +2615,10 @@ _VBoxManage() {
|
||||
_vms_comp vms 1
|
||||
elif [[ "${prev}" == "--type" ]]; then
|
||||
COMPREPLY=( $(compgen -W "gui sdl headless separate" -- ${cur}) )
|
||||
elif [[ "${prev}" == "--passwordfile" ]]; then
|
||||
elif [[ "${prev}" == "--password" ]]; then
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
else
|
||||
items=( --type --putenv --passwordfile --password-id )
|
||||
items=( --type --putenv --password --password-id )
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
fi
|
||||
@@ -2950,8 +2842,9 @@ _VBoxManage() {
|
||||
case "${subcommand}" in
|
||||
add|modify)
|
||||
local items=(--target --name --action --active
|
||||
--vendorid --productid --revision --manufacturer
|
||||
--product --remote --serialnumber --maskedinterfaces)
|
||||
--vendorid --productid --port --revision
|
||||
--manufacturer --product --remote --serialnumber
|
||||
--maskedinterfaces)
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
@@ -2970,4 +2863,9 @@ _VBoxManage() {
|
||||
complete -o default -F _VBoxManage VBoxManage
|
||||
complete -o default -F _VBoxManage vboxmanage
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" != 'VBoxManage' &&
|
||||
"${BASH_SOURCE[0]}" != 'vboxmanage' ]]; then
|
||||
complete -o default -F _VBoxManage $(basename "${BASH_SOURCE[0]}")
|
||||
fi
|
||||
|
||||
# vim: set ft=sh tw=80 sw=4 et :
|
||||
|
||||
Reference in New Issue
Block a user