mirror of
https://github.com/gryf/vboxmanage-bash-completion.git
synced 2026-04-18 05:33:35 +02:00
Compare commits
5 Commits
d60719b8e2
...
d2c25f9805
| Author | SHA1 | Date | |
|---|---|---|---|
| d2c25f9805 | |||
| 170b3a69d9 | |||
| ca2073b686 | |||
| 4d6210b599 | |||
| b231c43740 |
220
VBoxManage
220
VBoxManage
@@ -656,49 +656,53 @@ _VBoxManage() {
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
cloudprofile)
|
cloudprofile)
|
||||||
if [[ " ${COMP_WORDS[@]} " != *" --provider"* ||
|
if [[ " ${COMP_WORDS[*]} " != *" --provider"* ||
|
||||||
" ${COMP_WORDS[@]} " != *" --profile"* ]]; then
|
" ${COMP_WORDS[*]} " != *" --profile"* ]]; then
|
||||||
items=(--provider --profile)
|
items=(--provider --profile)
|
||||||
else
|
else
|
||||||
[[ " ${COMP_WORDS[@]} " != *" add"* &&
|
[[ " ${COMP_WORDS[*]} " != *" add"* &&
|
||||||
" ${COMP_WORDS[@]} " != *" update"* &&
|
" ${COMP_WORDS[*]} " != *" update"* &&
|
||||||
" ${COMP_WORDS[@]} " != *" delete"* &&
|
" ${COMP_WORDS[*]} " != *" delete"* &&
|
||||||
" ${COMP_WORDS[@]} " != *" show"* ]] &&
|
" ${COMP_WORDS[*]} " != *" show"* ]] &&
|
||||||
items=(add update delete show)
|
items=(add update delete show)
|
||||||
fi
|
fi
|
||||||
_get_excluded_items "${items[@]}"
|
_get_excluded_items "${items[@]}"
|
||||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||||
|
|
||||||
case "${prev}" in
|
if [[ " ${COMP_WORDS[*]} " == *" add"* ||
|
||||||
--provider)
|
" ${COMP_WORDS[*]} " == *" update"* ]]; then
|
||||||
COMPREPLY=()
|
|
||||||
_cloudproviders_comp
|
|
||||||
;;
|
|
||||||
--profile)
|
|
||||||
COMPREPLY=()
|
|
||||||
_cloudprofiles_comp
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
if [[ " ${COMP_WORDS[@]} " == *" add"* ||
|
|
||||||
" ${COMP_WORDS[@]} " == *" update"* ]]; then
|
|
||||||
COMPREPLY=( $(compgen -W "--clouduser --fingerprint --keyfile
|
COMPREPLY=( $(compgen -W "--clouduser --fingerprint --keyfile
|
||||||
--passphrase --tenancy --compartment" -- ${cur}) )
|
--passphrase --tenancy --compartment --region" -- ${cur}) )
|
||||||
|
else
|
||||||
|
case "${prev}" in
|
||||||
|
--provider)
|
||||||
|
COMPREPLY=()
|
||||||
|
_cloudproviders_comp
|
||||||
|
;;
|
||||||
|
--profile)
|
||||||
|
COMPREPLY=()
|
||||||
|
_cloudprofiles_comp
|
||||||
|
;;
|
||||||
|
--keyfile)
|
||||||
|
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||||
|
;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
cloud)
|
cloud)
|
||||||
if [ "${prev}" == "cloud" ]; then
|
if [ "${prev}" == "cloud" ]; then
|
||||||
items=(--provider --profile network)
|
items=(--provider --profile network)
|
||||||
elif [[ " ${COMP_WORDS[@]} " == *" network"* ]]; then
|
elif [[ " ${COMP_WORDS[*]} " == *" network"* ]]; then
|
||||||
items=(update delete info)
|
items=(update delete info)
|
||||||
elif [[ " ${COMP_WORDS[@]} " != *" --provider"* ||
|
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[*]} " != *" network"* &&
|
||||||
" ${COMP_WORDS[@]} " != *" image"* ]] &&
|
" ${COMP_WORDS[*]} " != *" image"* ]] &&
|
||||||
items=(list instance image network)
|
items=(list instance image network)
|
||||||
fi
|
fi
|
||||||
_get_excluded_items "${items[@]}"
|
_get_excluded_items "${items[@]}"
|
||||||
@@ -724,24 +728,24 @@ _VBoxManage() {
|
|||||||
export" -- ${cur}) )
|
export" -- ${cur}) )
|
||||||
;;
|
;;
|
||||||
network) # TODO: differentiate between setup/create and update/delete/info
|
network) # TODO: differentiate between setup/create and update/delete/info
|
||||||
if [[ " ${COMP_WORDS[@]} " == *" --provider"* ]]; then
|
if [[ " ${COMP_WORDS[*]} " == *" --provider"* ]]; then
|
||||||
COMPREPLY=( $(compgen -W "setup create" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "setup create" -- ${cur}) )
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
if [[ " ${COMP_WORDS[@]} " == *" list images"* ]]; then
|
if [[ " ${COMP_WORDS[*]} " == *" list images"* ||
|
||||||
|
" ${COMP_WORDS[*]} " == *" list instances"* ]]; then
|
||||||
items=(--state --compartment-id)
|
items=(--state --compartment-id)
|
||||||
_get_excluded_items "${items[@]}"
|
_get_excluded_items "${items[@]}"
|
||||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ " ${COMP_WORDS[@]} " == *" instance create"* ]]; then
|
if [[ " ${COMP_WORDS[*]} " == *" instance create"* ]]; then
|
||||||
items=( --domain-name --display-name --shape --subnet
|
items=( --domain-name --display-name --shape --subnet
|
||||||
--publicip --boot-disk-size --privateip --public-ssh-key
|
--publicip --boot-disk-size --privateip --public-ssh-key
|
||||||
--launch-mode --cloud-init-script-path )
|
--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)
|
||||||
|
|
||||||
_get_excluded_items "${items[@]}"
|
_get_excluded_items "${items[@]}"
|
||||||
@@ -757,57 +761,55 @@ _VBoxManage() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
if [[ " ${COMP_WORDS[@]} " == *" instance info"* ||
|
if [[ " ${COMP_WORDS[*]} " == *" instance info"* ||
|
||||||
" ${COMP_WORDS[@]} " == *" instance terminate"* ||
|
" ${COMP_WORDS[*]} " == *" instance terminate"* ||
|
||||||
" ${COMP_WORDS[@]} " == *" instance start"* ||
|
" ${COMP_WORDS[*]} " == *" instance start"* ||
|
||||||
" ${COMP_WORDS[@]} " == *" instance pause"* ]]; then
|
" ${COMP_WORDS[*]} " == *" instance pause"* ]]; then
|
||||||
COMPREPLY=( $(compgen -W "--id" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "--id" -- ${cur}) )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ " ${COMP_WORDS[@]} " == *" image create"* ]]; then
|
if [[ " ${COMP_WORDS[*]} " == *" image create"* ]]; then
|
||||||
items=(--display-name --bucket-name --object-name --instance-id)
|
items=(--display-name --bucket-name --object-name --instance-id)
|
||||||
|
|
||||||
_get_excluded_items "${items[@]}"
|
_get_excluded_items "${items[@]}"
|
||||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||||
fi
|
fi
|
||||||
if [[ " ${COMP_WORDS[@]} " == *" image info"* ||
|
if [[ " ${COMP_WORDS[*]} " == *" image info"* ||
|
||||||
" ${COMP_WORDS[@]} " == *" image delete"* ]]; then
|
" ${COMP_WORDS[*]} " == *" image delete"* ]]; then
|
||||||
COMPREPLY=( $(compgen -W "--id" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "--id" -- ${cur}) )
|
||||||
fi
|
fi
|
||||||
if [[ " ${COMP_WORDS[@]} " == *" image import"* ]]; then
|
if [[ " ${COMP_WORDS[*]} " == *" image import"* ]]; then
|
||||||
COMPREPLY=( $(compgen -W "--id --bucket-name
|
COMPREPLY=( $(compgen -W "--id --bucket-name
|
||||||
--object-name" -- ${cur}) )
|
--object-name" -- ${cur}) )
|
||||||
fi
|
fi
|
||||||
if [[ " ${COMP_WORDS[@]} " == *" image export"* ]]; then
|
if [[ " ${COMP_WORDS[*]} " == *" image export"* ]]; then
|
||||||
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
|
if [[ " ${COMP_WORDS[*]} " == *" network setup"* ]]; then
|
||||||
items=( --local-gateway-iso --gateway-os-name
|
items=( --compartment-id --gateway-os-name --gateway-os-version
|
||||||
--gateway-os-version --gateway-shape --tunnel-network-name
|
--gateway-shape --proxy --tunnel-network-name
|
||||||
--tunnel-network-range --guest-additions-iso --proxy
|
--tunnel-network-range )
|
||||||
--compartment-id )
|
|
||||||
_get_excluded_items "${items[@]}"
|
_get_excluded_items "${items[@]}"
|
||||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||||
fi
|
fi
|
||||||
if [[ " ${COMP_WORDS[@]} " == *" network create"* ]]; then
|
if [[ " ${COMP_WORDS[*]} " == *" network create"* ]]; then
|
||||||
items=( --name --network-id )
|
items=( --name --network-id )
|
||||||
[[ " ${COMP_WORDS[@]} " != *" --enable"* &&
|
[[ " ${COMP_WORDS[*]} " != *" --enable"* &&
|
||||||
" ${COMP_WORDS[@]} " != *" --disable"* ]] &&
|
" ${COMP_WORDS[*]} " != *" --disable"* ]] &&
|
||||||
items+=(--enable --disable)
|
items+=(--enable --disable)
|
||||||
_get_excluded_items "${items[@]}"
|
_get_excluded_items "${items[@]}"
|
||||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||||
fi
|
fi
|
||||||
if [[ " ${COMP_WORDS[@]} " == *" network update"* ]]; then
|
if [[ " ${COMP_WORDS[*]} " == *" network update"* ]]; then
|
||||||
items=( --name --network-id )
|
items=( --name --network-id )
|
||||||
[[ " ${COMP_WORDS[@]} " != *" --enable"* &&
|
[[ " ${COMP_WORDS[*]} " != *" --enable"* &&
|
||||||
" ${COMP_WORDS[@]} " != *" --disable"* ]] &&
|
" ${COMP_WORDS[*]} " != *" --disable"* ]] &&
|
||||||
items+=(--enable --disable)
|
items+=(--enable --disable)
|
||||||
_get_excluded_items "${items[@]}"
|
_get_excluded_items "${items[@]}"
|
||||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||||
fi
|
fi
|
||||||
if [[ " ${COMP_WORDS[@]} " == *" network info"* ||
|
if [[ " ${COMP_WORDS[*]} " == *" network info"* ||
|
||||||
" ${COMP_WORDS[@]} " == *" network delete"* ]]; then
|
" ${COMP_WORDS[*]} " == *" network delete"* ]]; then
|
||||||
COMPREPLY=( $(compgen -W "--name" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "--name" -- ${cur}) )
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
@@ -1457,7 +1459,7 @@ _VBoxManage() {
|
|||||||
items+=(--quiet -q)
|
items+=(--quiet -q)
|
||||||
|
|
||||||
_get_excluded_items "${items[@]}"
|
_get_excluded_items "${items[@]}"
|
||||||
compreply=( $(compgen -w "$result" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||||
;;
|
;;
|
||||||
|
|
||||||
start)
|
start)
|
||||||
@@ -1476,7 +1478,7 @@ _VBoxManage() {
|
|||||||
items+=(--quiet -q)
|
items+=(--quiet -q)
|
||||||
|
|
||||||
_get_excluded_items "${items[@]}"
|
_get_excluded_items "${items[@]}"
|
||||||
compreply=( $(compgen -w "$result" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||||
;;
|
;;
|
||||||
|
|
||||||
copyfrom|copyto)
|
copyfrom|copyto)
|
||||||
@@ -1972,15 +1974,18 @@ _VBoxManage() {
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
_find_item_name 2
|
_find_item_name 2
|
||||||
items=(--type --autoreset --property --compact --resize
|
items=( --autoreset --compact --description --move
|
||||||
--move --description --setlocation)
|
--property --setlocation --type )
|
||||||
|
[[ " ${COMP_WORDS[*]} " != *" --resize "* &&
|
||||||
|
" ${COMP_WORDS[*]} " != *" --resizebyte"* ]] &&
|
||||||
|
items+=( --resizebyte --resize )
|
||||||
_get_excluded_items "${items[@]}"
|
_get_excluded_items "${items[@]}"
|
||||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||||
case "${prev}" in
|
case "${prev}" in
|
||||||
--type)
|
--type)
|
||||||
COMPREPLY=( $(compgen -W "normal writethrough
|
COMPREPLY=( $(compgen -W "normal writethrough
|
||||||
immutable shareable readonly multiattach" --\
|
immutable shareable readonly multiattach" \
|
||||||
${cur}) )
|
-- ${cur}) )
|
||||||
;;
|
;;
|
||||||
--autoreset)
|
--autoreset)
|
||||||
COMPREPLY=( $(compgen -W "on off" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "on off" -- ${cur}) )
|
||||||
@@ -1997,6 +2002,55 @@ _VBoxManage() {
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
modifynvram)
|
||||||
|
items=( changevar deletevar enrollmssignatures enrollorclpk
|
||||||
|
enrollpk inituefivarstore listvars queryvar )
|
||||||
|
# _get_excluded_items "${items[@]}"
|
||||||
|
# COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||||
|
|
||||||
|
if [[ ${prev} == ${cmd} ]]; then
|
||||||
|
# COMPREPLY=( )
|
||||||
|
_vms_comp vms
|
||||||
|
else
|
||||||
|
_find_item_name 2
|
||||||
|
subcommand=${COMP_WORDS[$((index+1))]}
|
||||||
|
if [[ " ${items[*]} " == *" $subcommand "* ]]; then
|
||||||
|
case "${subcommand}" in
|
||||||
|
enrollpk)
|
||||||
|
if [ "${prev}" = "--platform-key" ]; then
|
||||||
|
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||||
|
else
|
||||||
|
items=( --platform-key --owner-uuid )
|
||||||
|
_get_excluded_items "${items[@]}"
|
||||||
|
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
queryvar|changevar)
|
||||||
|
if [ "${prev}" = "--filename" ]; then
|
||||||
|
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||||
|
else
|
||||||
|
items=( --name --filename )
|
||||||
|
_get_excluded_items "${items[@]}"
|
||||||
|
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
deletevar)
|
||||||
|
items=( --name --owner-uuid )
|
||||||
|
_get_excluded_items "${items[@]}"
|
||||||
|
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||||
|
;;
|
||||||
|
inituefivarstore|enrollmssignatures|enrollorclpk|\
|
||||||
|
listvars)
|
||||||
|
COMPREPLY=( )
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
[[ ${#COMPREPLY[@]} -eq 0 ]] && \
|
||||||
|
COMPREPLY=( $(compgen -W "${items[*]}" -- ${cur}) )
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
modifyvm)
|
modifyvm)
|
||||||
items=( --accelerate-2d-video --accelerate-3d --acpi --apic --audio
|
items=( --accelerate-2d-video --accelerate-3d --acpi --apic --audio
|
||||||
--audio-codec --audio-controller --audio-in --audio-out
|
--audio-codec --audio-controller --audio-in --audio-out
|
||||||
@@ -2520,9 +2574,6 @@ _VBoxManage() {
|
|||||||
showmediuminfo)
|
showmediuminfo)
|
||||||
if [[ ${prev} == ${cmd} ]]; then
|
if [[ ${prev} == ${cmd} ]]; then
|
||||||
COMPREPLY=( $(compgen -W "disk dvd floppy" -- ${cur}) )
|
COMPREPLY=( $(compgen -W "disk dvd floppy" -- ${cur}) )
|
||||||
_hdd_comp
|
|
||||||
_dvds_comp
|
|
||||||
_floppy_comp
|
|
||||||
else
|
else
|
||||||
case "${prev}" in
|
case "${prev}" in
|
||||||
disk)
|
disk)
|
||||||
@@ -2535,9 +2586,7 @@ _VBoxManage() {
|
|||||||
_floppy_comp
|
_floppy_comp
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
items=(--delete)
|
COMPREPLY=( )
|
||||||
_get_excluded_items "${items[@]}"
|
|
||||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
@@ -2560,6 +2609,43 @@ _VBoxManage() {
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
signova)
|
||||||
|
COMPREPLY=()
|
||||||
|
|
||||||
|
if [[ "${prev}" == "${cmd}" ]]; then
|
||||||
|
COMPREPLY=( $(compgen -o plusdirs -f -X '!@(*.ovf|*.ova)' \
|
||||||
|
-- ${cur}) )
|
||||||
|
else
|
||||||
|
if [[ " ${COMP_WORDS[*]} " != *" --certificate"* ||
|
||||||
|
" ${COMP_WORDS[*]} " != *" --private-key"* ]]; then
|
||||||
|
items=( --certificate --private-key )
|
||||||
|
_get_excluded_items "${items[@]}"
|
||||||
|
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||||
|
else
|
||||||
|
items=( --digest-type --intermediate-cert --force --dry-run )
|
||||||
|
[[ " ${COMP_WORDS[*]} " != *" --private-key-password "* &&
|
||||||
|
" ${COMP_WORDS[*]} " != *" --private-key-password-file"* ]] &&
|
||||||
|
items+=( --private-key-password-file
|
||||||
|
--private-key-password )
|
||||||
|
[[ " ${COMP_WORDS[*]} " != *" --verbose"* &&
|
||||||
|
" ${COMP_WORDS[*]} " != *" --quiet"* ]] &&
|
||||||
|
items+=( --verbose --quiet )
|
||||||
|
[[ " ${COMP_WORDS[*]} " != *" --pkcs7"* &&
|
||||||
|
" ${COMP_WORDS[*]} " != *" --no-pkcs7"* ]] &&
|
||||||
|
items+=( --pkcs7 --no-pkcs7 )
|
||||||
|
_get_excluded_items "${items[@]}"
|
||||||
|
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||||
|
|
||||||
|
case "${prev}" in
|
||||||
|
--certificate|--private-key|--private-key-password-file|\
|
||||||
|
--intermediate-cert)
|
||||||
|
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
snapshot)
|
snapshot)
|
||||||
items=(take delete restore restorecurrent edit list showvminfo)
|
items=(take delete restore restorecurrent edit list showvminfo)
|
||||||
if [[ ${prev} == ${cmd} ]]; then
|
if [[ ${prev} == ${cmd} ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user