mirror of
https://github.com/gryf/vboxmanage-bash-completion.git
synced 2026-03-26 11:43:31 +01: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)
|
||||
if [[ " ${COMP_WORDS[@]} " != *" --provider"* ||
|
||||
" ${COMP_WORDS[@]} " != *" --profile"* ]]; then
|
||||
if [[ " ${COMP_WORDS[*]} " != *" --provider"* ||
|
||||
" ${COMP_WORDS[*]} " != *" --profile"* ]]; then
|
||||
items=(--provider --profile)
|
||||
else
|
||||
[[ " ${COMP_WORDS[@]} " != *" add"* &&
|
||||
" ${COMP_WORDS[@]} " != *" update"* &&
|
||||
" ${COMP_WORDS[@]} " != *" delete"* &&
|
||||
" ${COMP_WORDS[@]} " != *" show"* ]] &&
|
||||
[[ " ${COMP_WORDS[*]} " != *" add"* &&
|
||||
" ${COMP_WORDS[*]} " != *" update"* &&
|
||||
" ${COMP_WORDS[*]} " != *" delete"* &&
|
||||
" ${COMP_WORDS[*]} " != *" show"* ]] &&
|
||||
items=(add update delete show)
|
||||
fi
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
|
||||
case "${prev}" in
|
||||
--provider)
|
||||
COMPREPLY=()
|
||||
_cloudproviders_comp
|
||||
;;
|
||||
--profile)
|
||||
COMPREPLY=()
|
||||
_cloudprofiles_comp
|
||||
;;
|
||||
esac
|
||||
if [[ " ${COMP_WORDS[@]} " == *" add"* ||
|
||||
" ${COMP_WORDS[@]} " == *" update"* ]]; then
|
||||
if [[ " ${COMP_WORDS[*]} " == *" add"* ||
|
||||
" ${COMP_WORDS[*]} " == *" update"* ]]; then
|
||||
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
|
||||
;;
|
||||
|
||||
cloud)
|
||||
if [ "${prev}" == "cloud" ]; then
|
||||
items=(--provider --profile network)
|
||||
elif [[ " ${COMP_WORDS[@]} " == *" network"* ]]; then
|
||||
elif [[ " ${COMP_WORDS[*]} " == *" network"* ]]; then
|
||||
items=(update delete info)
|
||||
elif [[ " ${COMP_WORDS[@]} " != *" --provider"* ||
|
||||
" ${COMP_WORDS[@]} " != *" --profile"* ]]; then
|
||||
elif [[ " ${COMP_WORDS[*]} " != *" --provider"* ||
|
||||
" ${COMP_WORDS[*]} " != *" --profile"* ]]; then
|
||||
items=(--provider --profile)
|
||||
else
|
||||
[[ " ${COMP_WORDS[@]} " != *" list"* &&
|
||||
" ${COMP_WORDS[@]} " != *" instance"* &&
|
||||
" ${COMP_WORDS[@]} " != *" network"* &&
|
||||
" ${COMP_WORDS[@]} " != *" image"* ]] &&
|
||||
[[ " ${COMP_WORDS[*]} " != *" list"* &&
|
||||
" ${COMP_WORDS[*]} " != *" instance"* &&
|
||||
" ${COMP_WORDS[*]} " != *" network"* &&
|
||||
" ${COMP_WORDS[*]} " != *" image"* ]] &&
|
||||
items=(list instance image network)
|
||||
fi
|
||||
_get_excluded_items "${items[@]}"
|
||||
@@ -724,24 +728,24 @@ _VBoxManage() {
|
||||
export" -- ${cur}) )
|
||||
;;
|
||||
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}) )
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if [[ " ${COMP_WORDS[@]} " == *" list images"* ]]; then
|
||||
|
||||
if [[ " ${COMP_WORDS[*]} " == *" list images"* ||
|
||||
" ${COMP_WORDS[*]} " == *" list instances"* ]]; then
|
||||
items=(--state --compartment-id)
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
fi
|
||||
|
||||
if [[ " ${COMP_WORDS[@]} " == *" instance create"* ]]; then
|
||||
if [[ " ${COMP_WORDS[*]} " == *" instance create"* ]]; then
|
||||
items=( --domain-name --display-name --shape --subnet
|
||||
--publicip --boot-disk-size --privateip --public-ssh-key
|
||||
--launch-mode --cloud-init-script-path )
|
||||
[[ " ${COMP_WORDS[@]} " != *" --image-id"* &&
|
||||
" ${COMP_WORDS[@]} " != *" --boot-volume-id"* ]] &&
|
||||
[[ " ${COMP_WORDS[*]} " != *" --image-id"* &&
|
||||
" ${COMP_WORDS[*]} " != *" --boot-volume-id"* ]] &&
|
||||
items+=(--image-id --boot-volume-id)
|
||||
|
||||
_get_excluded_items "${items[@]}"
|
||||
@@ -757,57 +761,55 @@ _VBoxManage() {
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [[ " ${COMP_WORDS[@]} " == *" instance info"* ||
|
||||
" ${COMP_WORDS[@]} " == *" instance terminate"* ||
|
||||
" ${COMP_WORDS[@]} " == *" instance start"* ||
|
||||
" ${COMP_WORDS[@]} " == *" instance pause"* ]]; then
|
||||
if [[ " ${COMP_WORDS[*]} " == *" instance info"* ||
|
||||
" ${COMP_WORDS[*]} " == *" instance terminate"* ||
|
||||
" ${COMP_WORDS[*]} " == *" instance start"* ||
|
||||
" ${COMP_WORDS[*]} " == *" instance pause"* ]]; then
|
||||
COMPREPLY=( $(compgen -W "--id" -- ${cur}) )
|
||||
fi
|
||||
|
||||
if [[ " ${COMP_WORDS[@]} " == *" image create"* ]]; then
|
||||
if [[ " ${COMP_WORDS[*]} " == *" image create"* ]]; then
|
||||
items=(--display-name --bucket-name --object-name --instance-id)
|
||||
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
fi
|
||||
if [[ " ${COMP_WORDS[@]} " == *" image info"* ||
|
||||
" ${COMP_WORDS[@]} " == *" image delete"* ]]; then
|
||||
if [[ " ${COMP_WORDS[*]} " == *" image info"* ||
|
||||
" ${COMP_WORDS[*]} " == *" image delete"* ]]; then
|
||||
COMPREPLY=( $(compgen -W "--id" -- ${cur}) )
|
||||
fi
|
||||
if [[ " ${COMP_WORDS[@]} " == *" image import"* ]]; then
|
||||
if [[ " ${COMP_WORDS[*]} " == *" image import"* ]]; then
|
||||
COMPREPLY=( $(compgen -W "--id --bucket-name
|
||||
--object-name" -- ${cur}) )
|
||||
fi
|
||||
if [[ " ${COMP_WORDS[@]} " == *" image export"* ]]; then
|
||||
if [[ " ${COMP_WORDS[*]} " == *" image export"* ]]; then
|
||||
COMPREPLY=( $(compgen -W "--id --display-name --bucket-name
|
||||
--object-name" -- ${cur}) )
|
||||
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 )
|
||||
if [[ " ${COMP_WORDS[*]} " == *" network setup"* ]]; then
|
||||
items=( --compartment-id --gateway-os-name --gateway-os-version
|
||||
--gateway-shape --proxy --tunnel-network-name
|
||||
--tunnel-network-range )
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
fi
|
||||
if [[ " ${COMP_WORDS[@]} " == *" network create"* ]]; then
|
||||
if [[ " ${COMP_WORDS[*]} " == *" network create"* ]]; then
|
||||
items=( --name --network-id )
|
||||
[[ " ${COMP_WORDS[@]} " != *" --enable"* &&
|
||||
" ${COMP_WORDS[@]} " != *" --disable"* ]] &&
|
||||
[[ " ${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
|
||||
if [[ " ${COMP_WORDS[*]} " == *" network update"* ]]; then
|
||||
items=( --name --network-id )
|
||||
[[ " ${COMP_WORDS[@]} " != *" --enable"* &&
|
||||
" ${COMP_WORDS[@]} " != *" --disable"* ]] &&
|
||||
[[ " ${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
|
||||
if [[ " ${COMP_WORDS[*]} " == *" network info"* ||
|
||||
" ${COMP_WORDS[*]} " == *" network delete"* ]]; then
|
||||
COMPREPLY=( $(compgen -W "--name" -- ${cur}) )
|
||||
fi
|
||||
;;
|
||||
@@ -1457,7 +1459,7 @@ _VBoxManage() {
|
||||
items+=(--quiet -q)
|
||||
|
||||
_get_excluded_items "${items[@]}"
|
||||
compreply=( $(compgen -w "$result" -- ${cur}) )
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
|
||||
start)
|
||||
@@ -1476,7 +1478,7 @@ _VBoxManage() {
|
||||
items+=(--quiet -q)
|
||||
|
||||
_get_excluded_items "${items[@]}"
|
||||
compreply=( $(compgen -w "$result" -- ${cur}) )
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
|
||||
copyfrom|copyto)
|
||||
@@ -1972,15 +1974,18 @@ _VBoxManage() {
|
||||
;;
|
||||
*)
|
||||
_find_item_name 2
|
||||
items=(--type --autoreset --property --compact --resize
|
||||
--move --description --setlocation)
|
||||
items=( --autoreset --compact --description --move
|
||||
--property --setlocation --type )
|
||||
[[ " ${COMP_WORDS[*]} " != *" --resize "* &&
|
||||
" ${COMP_WORDS[*]} " != *" --resizebyte"* ]] &&
|
||||
items+=( --resizebyte --resize )
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
case "${prev}" in
|
||||
--type)
|
||||
COMPREPLY=( $(compgen -W "normal writethrough
|
||||
immutable shareable readonly multiattach" --\
|
||||
${cur}) )
|
||||
immutable shareable readonly multiattach" \
|
||||
-- ${cur}) )
|
||||
;;
|
||||
--autoreset)
|
||||
COMPREPLY=( $(compgen -W "on off" -- ${cur}) )
|
||||
@@ -1997,6 +2002,55 @@ _VBoxManage() {
|
||||
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)
|
||||
items=( --accelerate-2d-video --accelerate-3d --acpi --apic --audio
|
||||
--audio-codec --audio-controller --audio-in --audio-out
|
||||
@@ -2520,9 +2574,6 @@ _VBoxManage() {
|
||||
showmediuminfo)
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
COMPREPLY=( $(compgen -W "disk dvd floppy" -- ${cur}) )
|
||||
_hdd_comp
|
||||
_dvds_comp
|
||||
_floppy_comp
|
||||
else
|
||||
case "${prev}" in
|
||||
disk)
|
||||
@@ -2535,9 +2586,7 @@ _VBoxManage() {
|
||||
_floppy_comp
|
||||
;;
|
||||
*)
|
||||
items=(--delete)
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
COMPREPLY=( )
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
@@ -2560,6 +2609,43 @@ _VBoxManage() {
|
||||
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)
|
||||
items=(take delete restore restorecurrent edit list showvminfo)
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
|
||||
Reference in New Issue
Block a user