mirror of
https://github.com/gryf/vboxmanage-bash-completion.git
synced 2026-03-26 11:43:31 +01:00
Compare commits
10 Commits
c93cfdb0f1
...
7.0.4
| Author | SHA1 | Date | |
|---|---|---|---|
| 7c13b0ab6b | |||
| 67ac4d655f | |||
| 8dd76f3295 | |||
| 8fd579c2cd | |||
| 51a393f8fe | |||
| f23ce2aedb | |||
| 350e0aedaf | |||
| 25d7fb4048 | |||
| 0077621f1b | |||
| 52aa7111fa |
@@ -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.4, 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:
|
||||
|
||||
432
VBoxManage
432
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: 6.1.38
|
||||
# Version: 7.0.4
|
||||
|
||||
|
||||
_VBoxManage() {
|
||||
@@ -41,7 +41,7 @@ _VBoxManage() {
|
||||
|
||||
result=""
|
||||
for i in $@; do
|
||||
[[ " ${COMP_WORDS[@]} " == *" $i "* ]] && continue
|
||||
[[ " ${COMP_WORDS[*]} " == *" $i "* ]] && continue
|
||||
result="$result $i"
|
||||
done
|
||||
}
|
||||
@@ -51,7 +51,7 @@ _VBoxManage() {
|
||||
|
||||
result=""
|
||||
for i in $@; do
|
||||
if [[ " ${COMP_WORDS[@]} " == *" $i "* ]]; then
|
||||
if [[ " ${COMP_WORDS[*]} " == *" $i "* ]]; then
|
||||
result="ITIS"
|
||||
break
|
||||
fi
|
||||
@@ -423,7 +423,7 @@ _VBoxManage() {
|
||||
# foo bar disk baz
|
||||
# will search for word disk.
|
||||
_get_medium () {
|
||||
case "${COMP_WORDS[COMP_CWORD-2]}" in
|
||||
case "${COMP_WORDS[$COMP_CWORD-2]}" in
|
||||
disk)
|
||||
_hdd_comp
|
||||
;;
|
||||
@@ -475,9 +475,9 @@ _VBoxManage() {
|
||||
COMP_WORDBREAKS=${COMP_WORDBREAKS//|/} # remove pipe from comp word breaks
|
||||
COMPREPLY=()
|
||||
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
if [[ COMP_CWORD -ge 2 ]]; then
|
||||
cur="${COMP_WORDS[$COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[$COMP_CWORD-1]}"
|
||||
if [[ $COMP_CWORD -ge 2 ]]; then
|
||||
cmd="${COMP_WORDS[1]}"
|
||||
if [[ $cmd == "-q" ]]; then
|
||||
cmd="${COMP_WORDS[2]}"
|
||||
@@ -507,13 +507,13 @@ _VBoxManage() {
|
||||
;;
|
||||
|
||||
bandwidthctl)
|
||||
local items=(add set remove list)
|
||||
local items=( add list remove set )
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
_vms_comp vms
|
||||
else
|
||||
_find_item_name 2
|
||||
subcommand=${COMP_WORDS[$((index+1))]}
|
||||
if [[ " ${items[@]} " == *" $subcommand "* ]]; then
|
||||
if [[ " ${items[*]} " == *" $subcommand "* ]]; then
|
||||
case "${subcommand}" in
|
||||
add)
|
||||
items=(--type --limit)
|
||||
@@ -524,7 +524,7 @@ _VBoxManage() {
|
||||
if [[ ${prev} == "set" ]]; then
|
||||
_bandwidthctl_comp
|
||||
else
|
||||
[[ " ${COMP_WORDS[@]} " != *" --limit "* ]] && \
|
||||
[[ " ${COMP_WORDS[*]} " != *" --limit "* ]] && \
|
||||
COMPREPLY=( $(compgen -W "--limit" -- \
|
||||
${cur}) )
|
||||
fi
|
||||
@@ -563,35 +563,30 @@ _VBoxManage() {
|
||||
|
||||
clonemedium)
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
COMPREPLY=( $(compgen -W "disk dvd floppy" -- ${cur}) )
|
||||
_hdd_comp
|
||||
_floppy_comp
|
||||
_dvds_comp
|
||||
elif [[ ${#COMP_WORDS[@]} -eq 4 ]]; then
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
else
|
||||
|
||||
case "${prev}" in
|
||||
disk)
|
||||
_hdd_comp
|
||||
--format)
|
||||
COMPREPLY=( $(compgen -W "VDI VMDK VHD RAW" -- ${cur}) )
|
||||
;;
|
||||
dvd)
|
||||
_dvds_comp
|
||||
;;
|
||||
floppy)
|
||||
_floppy_comp
|
||||
--variant)
|
||||
COMPREPLY=( $(compgen -W "Standard Fixed Split2G Stream
|
||||
ESX" -- ${cur}) )
|
||||
;;
|
||||
*)
|
||||
_find_item_name 2
|
||||
items=(--format --variant --existing)
|
||||
items=( --existing --format --variant )
|
||||
[[ " ${COMP_WORDS[*]} " != *" disk "* &&
|
||||
" ${COMP_WORDS[*]} " != *" dvd "* &&
|
||||
" ${COMP_WORDS[*]} " != *" floppy "* ]] &&
|
||||
items+=(disk dvd floppy)
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
|
||||
case "${prev}" in
|
||||
--format)
|
||||
COMPREPLY=( $(compgen -W "VDI VMDK VHD RAW" --\
|
||||
${cur}) )
|
||||
;;
|
||||
--variant)
|
||||
COMPREPLY=( $(compgen -W "Standard Fixed Split2G
|
||||
Stream ESX" -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
@@ -987,11 +982,12 @@ _VBoxManage() {
|
||||
;;
|
||||
|
||||
convertfromraw)
|
||||
local items=(--format --variant --uuid)
|
||||
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
COMPREPLY=( $(compgen -W "${items[*]}" -- ${cur}) )
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
elif [[ ${#COMP_WORDS[@]} -eq 4 ]]; then
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
else
|
||||
items=(--format --variant --uuid)
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
case "${prev}" in
|
||||
@@ -1016,8 +1012,8 @@ _VBoxManage() {
|
||||
COMPREPLY=( $(compgen -W "${items[*]}" -- ${cur}) )
|
||||
;;
|
||||
*)
|
||||
[[ " ${COMP_WORDS[@]} " == *" --size "* ||
|
||||
" ${COMP_WORDS[@]} " == *" --sizebyte "* ]] &&
|
||||
[[ " ${COMP_WORDS[*]} " == *" --size "* ||
|
||||
" ${COMP_WORDS[*]} " == *" --sizebyte "* ]] &&
|
||||
items=(--filename --diffparent --format --variant)
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
@@ -1031,12 +1027,12 @@ _VBoxManage() {
|
||||
_hdd_comp
|
||||
;;
|
||||
--format)
|
||||
COMPREPLY=( $(compgen -W "VDI VMDK VHD" --\
|
||||
${cur}) )
|
||||
COMPREPLY=( $(compgen -W "VDI VMDK VHD" \
|
||||
-- ${cur}) )
|
||||
;;
|
||||
--variant)
|
||||
COMPREPLY=( $(compgen -W "Standard Fixed Split2G
|
||||
Stream ESX Formatted" -- ${cur}) )
|
||||
Stream ESX Formatted RawDisk" -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
@@ -1421,203 +1417,147 @@ _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=( --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=( --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=( --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[@]}"
|
||||
@@ -1625,97 +1565,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}) )
|
||||
;;
|
||||
@@ -1744,7 +1618,7 @@ _VBoxManage() {
|
||||
|
||||
if [[ "${prev}" == "${subcommand}" ]]; then
|
||||
_vms_comp vms
|
||||
elif [[ " ${items[@]} " == *" $subcommand "* ]]; then
|
||||
elif [[ " ${items[*]} " == *" $subcommand "* ]]; then
|
||||
case "${subcommand}" in
|
||||
get)
|
||||
_get_excluded_items "--verbose"
|
||||
@@ -1755,7 +1629,8 @@ _VBoxManage() {
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
enumerate)
|
||||
_get_excluded_items "--patterns"
|
||||
_get_excluded_items "--no-timestamp --no-flags --relative
|
||||
--old-format"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
wait)
|
||||
@@ -1780,18 +1655,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[@]}"
|
||||
@@ -1846,7 +1721,7 @@ _VBoxManage() {
|
||||
COMPREPLY=( $(compgen -o dirnames -- ${cur}) )
|
||||
;;
|
||||
|
||||
--eula)=
|
||||
--eula)
|
||||
COMPREPLY=( $(compgen -W "show accept" -- ${cur}) )
|
||||
;;
|
||||
--settingsfile)
|
||||
@@ -1919,7 +1794,7 @@ _VBoxManage() {
|
||||
disk|dvd|floppy)
|
||||
COMPREPLY=( $(compgen -W "get set delete" -- ${cur}) )
|
||||
;;
|
||||
get|set|floppy)
|
||||
get|set|delete)
|
||||
_get_medium
|
||||
;;
|
||||
esac
|
||||
@@ -1927,9 +1802,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
|
||||
@@ -2463,20 +2338,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[@]}"
|
||||
@@ -2676,7 +2551,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)
|
||||
@@ -2740,17 +2615,21 @@ _VBoxManage() {
|
||||
_vms_comp vms
|
||||
else
|
||||
_find_item_name 2
|
||||
local items=(--storagectl --port --device --type --medium --mtype
|
||||
--comment --setuuid --setparentuuid --passthrough --tempeject
|
||||
--nonrotational --discard --hotpluggable --bandwidthgroup
|
||||
--forceunmount --server --target --tport --lun --encodedlun
|
||||
--username --password --initiator --intnet --passwordfile)
|
||||
local items=( --bandwidthgroup --comment --device --discard
|
||||
--encodedlun --forceunmount --hotpluggable --initiator --intnet
|
||||
--lun --medium --mtype --nonrotational --passthrough --password
|
||||
--passwordfile --port --server --setparentuuid --setuuid
|
||||
--storagectl --target --tempeject --tport --type --username )
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
|
||||
case "${prev}" in
|
||||
--type)
|
||||
COMPREPLY=( $(compgen -W "dvddrive hdd fdd" -- ${cur}) )
|
||||
--bandwidthgroup)
|
||||
COMPREPLY=( $(compgen -W "none" -- ${cur}) )
|
||||
;;
|
||||
--discard|--hotpluggable|--nonrotational|--passthrough|\
|
||||
--tempeject)
|
||||
COMPREPLY=( $(compgen -W "on off" -- ${cur}) )
|
||||
;;
|
||||
--medium)
|
||||
COMPREPLY=()
|
||||
@@ -2767,19 +2646,19 @@ _VBoxManage() {
|
||||
COMPREPLY=( $(compgen -W "normal writethrough immutable
|
||||
shareable readonly multiattach" -- ${cur}) )
|
||||
;;
|
||||
--passthrough|--tempeject|--nonrotational|--discard)
|
||||
COMPREPLY=( $(compgen -W "on off" -- ${cur}) )
|
||||
;;
|
||||
--passwordfile)
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
;;
|
||||
--type)
|
||||
COMPREPLY=( $(compgen -W "dvddrive hdd fdd" -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
|
||||
storagectl)
|
||||
local items=(--name --add --controller --portcount --hostiocache
|
||||
--bootable --rename --remove)
|
||||
local items=( --add --bootable --controller --hostiocache --name
|
||||
--portcount --remove --rename )
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
_vms_comp vms
|
||||
else
|
||||
@@ -2787,12 +2666,13 @@ _VBoxManage() {
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
case "${prev}" in
|
||||
--add)
|
||||
COMPREPLY=( $(compgen -W "ide sata scsi floppy
|
||||
sas usb pcie" -- ${cur}) )
|
||||
COMPREPLY=( $(compgen -W "floppy ide pcie sas sata scsi
|
||||
usb" -- ${cur}) )
|
||||
;;
|
||||
--controller)
|
||||
COMPREPLY=( $(compgen -W "LSILogic LSILogicSAS BusLogic
|
||||
IntelAHCI PIIX3 PIIX4 ICH6 I82078 USB NVMe" -- ${cur}) )
|
||||
COMPREPLY=( $(compgen -W "BusLogic I82078 ICH6 IntelAhci
|
||||
LSILogic LSILogicSAS NVMe PIIX3 PIIX4 USB VirtIO" \
|
||||
-- ${cur}) )
|
||||
;;
|
||||
--bootable|--hostiocache)
|
||||
COMPREPLY=( $(compgen -W "on off" -- ${cur}) )
|
||||
@@ -2802,7 +2682,7 @@ _VBoxManage() {
|
||||
;;
|
||||
|
||||
unattended)
|
||||
if [[ COMP_CWORD -ge 3 ]]; then
|
||||
if [[ $COMP_CWORD -ge 3 ]]; then
|
||||
subcommand="${COMP_WORDS[2]}"
|
||||
if [[ $subcommand == "${cmd}" ]]; then
|
||||
subcommand="${COMP_WORDS[3]}"
|
||||
@@ -2899,7 +2779,7 @@ _VBoxManage() {
|
||||
;;
|
||||
|
||||
usbdevsource)
|
||||
if [[ COMP_CWORD -ge 3 ]]; then
|
||||
if [[ $COMP_CWORD -ge 3 ]]; then
|
||||
subcommand="${COMP_WORDS[2]}"
|
||||
if [[ $subcommand == "${cmd}" ]]; then
|
||||
subcommand="${COMP_WORDS[3]}"
|
||||
@@ -2922,7 +2802,7 @@ _VBoxManage() {
|
||||
;;
|
||||
|
||||
usbfilter)
|
||||
if [[ COMP_CWORD -ge 3 ]]; then
|
||||
if [[ $COMP_CWORD -ge 3 ]]; then
|
||||
subcommand="${COMP_WORDS[2]}"
|
||||
if [[ $subcommand == "${cmd}" ]]; then
|
||||
subcommand="${COMP_WORDS[3]}"
|
||||
|
||||
Reference in New Issue
Block a user