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