mirror of
https://github.com/gryf/vboxmanage-bash-completion.git
synced 2026-03-26 11:43:31 +01:00
Compare commits
3 Commits
d2c25f9805
...
c93cfdb0f1
| Author | SHA1 | Date | |
|---|---|---|---|
| c93cfdb0f1 | |||
| d01352a68a | |||
| 5da82d54da |
273
VBoxManage
273
VBoxManage
@@ -655,41 +655,6 @@ _VBoxManage() {
|
||||
fi
|
||||
;;
|
||||
|
||||
cloudprofile)
|
||||
if [[ " ${COMP_WORDS[*]} " != *" --provider"* ||
|
||||
" ${COMP_WORDS[*]} " != *" --profile"* ]]; then
|
||||
items=(--provider --profile)
|
||||
else
|
||||
[[ " ${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}) )
|
||||
|
||||
if [[ " ${COMP_WORDS[*]} " == *" add"* ||
|
||||
" ${COMP_WORDS[*]} " == *" update"* ]]; then
|
||||
COMPREPLY=( $(compgen -W "--clouduser --fingerprint --keyfile
|
||||
--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)
|
||||
@@ -814,6 +779,41 @@ _VBoxManage() {
|
||||
fi
|
||||
;;
|
||||
|
||||
cloudprofile)
|
||||
if [[ " ${COMP_WORDS[*]} " != *" --provider"* ||
|
||||
" ${COMP_WORDS[*]} " != *" --profile"* ]]; then
|
||||
items=(--provider --profile)
|
||||
else
|
||||
[[ " ${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}) )
|
||||
|
||||
if [[ " ${COMP_WORDS[*]} " == *" add"* ||
|
||||
" ${COMP_WORDS[*]} " == *" update"* ]]; then
|
||||
COMPREPLY=( $(compgen -W "--clouduser --fingerprint --keyfile
|
||||
--passphrase --tenancy --compartment --region" -- ${cur}) )
|
||||
else
|
||||
case "${prev}" in
|
||||
--provider)
|
||||
COMPREPLY=()
|
||||
_cloudproviders_comp
|
||||
;;
|
||||
--profile)
|
||||
COMPREPLY=()
|
||||
_cloudprofiles_comp
|
||||
;;
|
||||
--keyfile)
|
||||
COMPREPLY=( $(compgen -f -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
|
||||
controlvm)
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
_vms_comp runningvms
|
||||
@@ -1804,6 +1804,29 @@ _VBoxManage() {
|
||||
fi
|
||||
;;
|
||||
|
||||
hostonlynet)
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
COMPREPLY=( $(compgen -W "add modify remove" -- ${cur}) )
|
||||
else
|
||||
subcommand=${COMP_WORDS[2]}
|
||||
if [[ " ${COMP_WORDS[*]} " != *" --name"* &&
|
||||
" ${COMP_WORDS[*]} " != *" --id"* ]]; then
|
||||
COMPREPLY=( $(compgen -W "--name --id" -- ${cur}) )
|
||||
else
|
||||
case "${subcommand}" in
|
||||
add|modify)
|
||||
items=( --netmask --lower-ip --upper-ip )
|
||||
[[ " ${COMP_WORDS[*]} " != *" --enable "* &&
|
||||
" ${COMP_WORDS[*]} " != *" --disable "* ]] &&
|
||||
items+=( --enable --disable )
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
import)
|
||||
items=(--basefolder --cloud --cloudbucket --cloudinstanceid
|
||||
--cloudprofile --controller --cpus --description --disk
|
||||
@@ -2778,81 +2801,6 @@ _VBoxManage() {
|
||||
fi
|
||||
;;
|
||||
|
||||
unregistervm)
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
_vms_comp vms
|
||||
else
|
||||
local items=(--delete)
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
fi
|
||||
;;
|
||||
|
||||
usbfilter)
|
||||
if [[ COMP_CWORD -ge 3 ]]; then
|
||||
subcommand="${COMP_WORDS[2]}"
|
||||
if [[ $subcommand == "${cmd}" ]]; then
|
||||
subcommand="${COMP_WORDS[3]}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
COMPREPLY=( $(compgen -W "add modify remove" -- ${cur}) )
|
||||
else
|
||||
case "${prev}" in
|
||||
--target)
|
||||
_vms_comp vms
|
||||
COMPREPLY+=( $(compgen -W "global" -- ${cur}) )
|
||||
;;
|
||||
--action)
|
||||
COMPREPLY=( $(compgen -W "ignore hold" -- ${cur}) )
|
||||
;;
|
||||
--active|--remote)
|
||||
COMPREPLY=( $(compgen -W "yes no" -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
if [[ ${#COMPREPLY[@]} -eq 0 ]]; then
|
||||
case "${subcommand}" in
|
||||
add|modify)
|
||||
local items=(--target --name --action --active
|
||||
--vendorid --productid --revision --manufacturer
|
||||
--product --remote --serialnumber --maskedinterfaces)
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
remove)
|
||||
local items=(--target)
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
usbdevsource)
|
||||
if [[ COMP_CWORD -ge 3 ]]; then
|
||||
subcommand="${COMP_WORDS[2]}"
|
||||
if [[ $subcommand == "${cmd}" ]]; then
|
||||
subcommand="${COMP_WORDS[3]}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
COMPREPLY=( $(compgen -W "add remove" -- ${cur}) )
|
||||
else
|
||||
if [[ ${#COMPREPLY[@]} -eq 0 ]]; then
|
||||
case "${subcommand}" in
|
||||
add)
|
||||
local items=(--address --backend)
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
unattended)
|
||||
if [[ COMP_CWORD -ge 3 ]]; then
|
||||
subcommand="${COMP_WORDS[2]}"
|
||||
@@ -2910,6 +2858,111 @@ _VBoxManage() {
|
||||
fi
|
||||
;;
|
||||
|
||||
unregistervm)
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
_vms_comp vms
|
||||
else
|
||||
local items=(--delete)
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
fi
|
||||
;;
|
||||
|
||||
updatecheck)
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
COMPREPLY=( $(compgen -W "list modify perform" -- ${cur}) )
|
||||
else
|
||||
subcommand=${COMP_WORDS[2]}
|
||||
case "${subcommand}" in
|
||||
list|perform)
|
||||
items=( --machine-readable )
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
modify)
|
||||
case "${prev}" in
|
||||
--channel)
|
||||
COMPREPLY=( $(compgen -W "stable withbetas all" \
|
||||
-- ${cur}) )
|
||||
;;
|
||||
*)
|
||||
items=( --channel --frequency )
|
||||
[[ " ${COMP_WORDS[*]} " != *" --enable "* &&
|
||||
" ${COMP_WORDS[*]} " != *" --disable "* ]] &&
|
||||
items+=( --enable --disable )
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
|
||||
usbdevsource)
|
||||
if [[ COMP_CWORD -ge 3 ]]; then
|
||||
subcommand="${COMP_WORDS[2]}"
|
||||
if [[ $subcommand == "${cmd}" ]]; then
|
||||
subcommand="${COMP_WORDS[3]}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
COMPREPLY=( $(compgen -W "add remove" -- ${cur}) )
|
||||
else
|
||||
if [[ ${#COMPREPLY[@]} -eq 0 ]]; then
|
||||
case "${subcommand}" in
|
||||
add)
|
||||
local items=(--address --backend)
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
usbfilter)
|
||||
if [[ COMP_CWORD -ge 3 ]]; then
|
||||
subcommand="${COMP_WORDS[2]}"
|
||||
if [[ $subcommand == "${cmd}" ]]; then
|
||||
subcommand="${COMP_WORDS[3]}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
COMPREPLY=( $(compgen -W "add modify remove" -- ${cur}) )
|
||||
else
|
||||
case "${prev}" in
|
||||
--target)
|
||||
_vms_comp vms
|
||||
COMPREPLY+=( $(compgen -W "global" -- ${cur}) )
|
||||
;;
|
||||
--action)
|
||||
COMPREPLY=( $(compgen -W "ignore hold" -- ${cur}) )
|
||||
;;
|
||||
--active|--remote)
|
||||
COMPREPLY=( $(compgen -W "yes no" -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
if [[ ${#COMPREPLY[@]} -eq 0 ]]; then
|
||||
case "${subcommand}" in
|
||||
add|modify)
|
||||
local items=(--target --name --action --active
|
||||
--vendorid --productid --revision --manufacturer
|
||||
--product --remote --serialnumber --maskedinterfaces)
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
remove)
|
||||
local items=(--target)
|
||||
_get_excluded_items "${items[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
esac
|
||||
}
|
||||
complete -o default -F _VBoxManage VBoxManage
|
||||
|
||||
Reference in New Issue
Block a user