1 Commits
7.1.8 ... 7.2.4

Author SHA1 Message Date
dffdf72bb9 Bump to 7.2.4 2026-03-24 20:24:05 +01:00
2 changed files with 187 additions and 144 deletions

View File

@@ -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
7.1.8, and should contain all commands and their options.
7.2.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:

View File

@@ -3,7 +3,7 @@
# Author: Roman 'gryf' Dobosz <gryf73@gmail.com>
# URL: https://github.com/gryf/vboxmanage-bash-completion
# License: 3-clause BSD-style license (see LICENSE file)
# Version: 7.1.8
# Version: 7.2.4
_VBoxManage() {
@@ -474,6 +474,24 @@ _VBoxManage() {
done
}
_iface_comp() {
local ifaces
local item
ifaces=$(VBoxManage objtracker ifaces | \
grep -v "Supported interfaces:" | \
$VBMC_SED 's/^\s\+//g' | \
$VBMC_SED 's/\s\+$//g' | \
tr '\n' '|' | \
$VBMC_SED 's/|$//')
IFS='|' read -ra ifaces <<< "$ifaces"
for item in "${ifaces[@]}"
do
[[ ${item^^} == ${cur^^}* ]] && COMPREPLY+=("$item")
done
}
COMP_WORDBREAKS=${COMP_WORDBREAKS//|/} # remove pipe from comp word breaks
COMPREPLY=()
@@ -2025,7 +2043,7 @@ _VBoxManage() {
;;
modifyvm)
items=(--accelerate-2d-video --accelerate-3d --acpi --apic --audio
items=(--accelerate-3d --acpi --apic --arm-gic-its --audio
--audio-codec --audio-controller --audio-in --audio-out
--autostart-delay --autostart-enabled --boot1 --boot2 --boot3
--boot4 --bridge-adapter1 --bridge-adapter2 --bridge-adapter3
@@ -2058,22 +2076,20 @@ _VBoxManage() {
--lpt-mode1 --lpt1 --mac-address1 --mac-address2 --mac-address3
--mac-address4 --mac-address5 --mac-address6 --mac-address7
--mac-address8 --mds-clear-on-sched --mds-clear-on-vm-entry
--memory --monitor-count --mouse --name --nat-alias-mode1
--nat-alias-mode2 --nat-alias-mode3 --nat-alias-mode4
--nat-alias-mode5 --nat-alias-mode6 --nat-alias-mode7
--nat-alias-mode8 --nat-bind-ip1 --nat-bind-ip2 --nat-bind-ip3
--nat-bind-ip4 --nat-bind-ip5 --nat-bind-ip6 --nat-bind-ip7
--nat-bind-ip8 --nat-dns-host-resolver1 --nat-dns-host-resolver2
--nat-dns-host-resolver3 --nat-dns-host-resolver4
--nat-dns-host-resolver5 --nat-dns-host-resolver6
--nat-dns-host-resolver7 --nat-dns-host-resolver8
--memory --monitor-count --mouse --name --nat-bind-ip1
--nat-bind-ip2 --nat-bind-ip3 --nat-bind-ip4 --nat-bind-ip5
--nat-bind-ip6 --nat-bind-ip7 --nat-bind-ip8
--nat-dns-pass-domain1 --nat-dns-pass-domain2
--nat-dns-pass-domain3 --nat-dns-pass-domain4
--nat-dns-pass-domain5 --nat-dns-pass-domain6
--nat-dns-pass-domain7 --nat-dns-pass-domain8 --nat-dns-proxy1
--nat-dns-proxy2 --nat-dns-proxy3 --nat-dns-proxy4
--nat-dns-proxy5 --nat-dns-proxy6 --nat-dns-proxy7
--nat-dns-proxy8 --nat-localhostreachable1
--nat-dns-pass-domain7 --nat-dns-pass-domain8 --nat-enable-tftp1
--nat-enable-tftp2 --nat-enable-tftp3 --nat-enable-tftp4
--nat-enable-tftp5 --nat-enable-tftp6 --nat-enable-tftp7
--nat-enable-tftp8 --nat-forward-broadcast1
--nat-forward-broadcast2 --nat-forward-broadcast3
--nat-forward-broadcast4 --nat-forward-broadcast5
--nat-forward-broadcast6 --nat-forward-broadcast7
--nat-forward-broadcast8 --nat-localhostreachable1
--nat-localhostreachable2 --nat-localhostreachable3
--nat-localhostreachable4 --nat-localhostreachable5
--nat-localhostreachable6 --nat-localhostreachable7
@@ -2146,23 +2162,23 @@ _VBoxManage() {
_os_comp
;;
--accelerate-2d-video|--accelerate-3d|--acpi|--apic|\
--audio-in|--audio-out|--autostart-enabled|\
--cable-connected1|--cable-connected2|--cable-connected3|\
--cable-connected4|--cable-connected5|--cable-connected6|\
--cable-connected7|--cable-connected8|--cpu-hotplug|\
--firmware-logo-fade-in|--firmware-logo-fade-out|\
--firmware-pxe-debug|--hwvirtex|--ibpb-on-vm-entry|\
--ibpb-on-vm-exit|--ioapic|--l1d-flush-on-sched|\
--l1d-flush-on-vm-entry|--large-pages|--mds-clear-on-sched|\
--mds-clear-on-vm-entry|--nat-dns-host-resolver[1-8]|\
--nat-dns-pass-domain[1-8]|--nat-dns-proxy[1-8]|\
--nat-localhostreachable[1-8]|--nested-hw-virt|\
--nested-paging|--nic-trace[1-8]|--page-fusion|--recording|\
--rtc-use-utc|--spec-ctrl|--system-uuid-le|--teleporter|\
--testing-enabled|--testing-mmio|--tracing-allow-vm-access|\
--tracing-enabled|--triple-fault-reset|--usb-card-reader|\
--usb-ehci|--usb-ohci|--usb-xhci|--virt-vmsave-vmload|--vrde|\
--accelerate-3d|--acpi|--apic|--arm-gic-its|--audio-in|\
--audio-out|--autostart-enabled|--cable-connected1|\
--cable-connected2|--cable-connected3|--cable-connected4|\
--cable-connected5|--cable-connected6|--cable-connected7|\
--cable-connected8|--cpu-hotplug|--firmware-logo-fade-in|\
--firmware-logo-fade-out|--firmware-pxe-debug|--hwvirtex|\
--ibpb-on-vm-entry|--ibpb-on-vm-exit|--ioapic|\
--l1d-flush-on-sched|--l1d-flush-on-vm-entry|--large-pages|\
--mds-clear-on-sched|--mds-clear-on-vm-entry|\
--nat-dns-pass-domain[1-8]|--nat-enable-tftp[1-8]|\
--nat-forward-broadcast[1-8]|--nat-localhostreachable[1-8]|\
--nested-hw-virt|--nested-paging|--nic-trace[1-8]|\
--page-fusion|--recording|--rtc-use-utc|--spec-ctrl|\
--system-uuid-le|--teleporter|--testing-enabled|\
--testing-mmio|--tracing-allow-vm-access|--tracing-enabled|\
--triple-fault-reset|--usb-card-reader|--usb-ehci|\
--usb-ohci|--usb-xhci|--virt-vmsave-vmload|--vrde|\
--vrde-multi-con|--vrde-reuse-con|--vrde-video-channel|\
--x86-hpet|--x86-long-mode|--x86-pae|--x86-vtx-ux|\
--x86-vtx-vpid|--x86-x2apic)
@@ -2206,7 +2222,7 @@ _VBoxManage() {
--nic-type[1-8])
COMPREPLY=( $(compgen -W "Am79C970A Am79C973 82540EM
82543GC 82545EM virtio" -- ${cur}) )
82543GC 82545EM virtio usbnet" -- ${cur}) )
;;
--nic-promisc[1-8])
@@ -2254,10 +2270,6 @@ _VBoxManage() {
COMPREPLY=( $(compgen -W "delete" -- ${cur}) )
;;
--nat-alias-mode[1-8])
COMPREPLY=( $(compgen -W "default" -- ${cur}) )
;;
--macaddress[1-8])
COMPREPLY=( $(compgen -W "auto" -- ${cur}) )
;;
@@ -2456,6 +2468,27 @@ _VBoxManage() {
fi
;;
objtracker)
items=(ifaces objlist objinfo)
case "${prev}" in
objlist)
items=(--ifacename)
_get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
;;
objinfo)
items=(--ifacename --id)
_get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
;;
--ifacename)
_iface_comp
;;
esac
[[ ${#COMPREPLY[@]} -eq 0 ]] && \
COMPREPLY=( $(compgen -W "${items[*]}" -- ${cur}) )
;;
registervm)
if [[ ${prev} == ${cmd} ]]; then
bind 'set mark-directories on'
@@ -2524,7 +2557,11 @@ _VBoxManage() {
items=(add remove modify)
subcommand=${COMP_WORDS[2]}
case "${prev}" in
add|remove|modify)
add|remove)
_vms_comp vms
COMPREPLY+=( "global" )
;;
modify)
_vms_comp vms
;;
--hostpath)
@@ -2798,7 +2835,8 @@ _VBoxManage() {
COMPREPLY=( $(compgen -W "detect install" -- ${cur}) )
else
case "${prev}" in
--iso|--password-file|--additions-iso|--validation-kit-iso|\
--admin-password-file|--iso|--user-password-file|\
--additions-iso|--validation-kit-iso|\
--script-template|--post-install-template)
COMPREPLY+=( $(compgen -f -- ${cur}) )
;;
@@ -2822,7 +2860,7 @@ _VBoxManage() {
if [[ ${prev} == ${subcommand} ]]; then
_vms_comp vms
else
local items=(--additions-iso --admin-password
local items=(--additions-iso
--auxiliary-base-path --country --dry-run
--extra-install-kernel-parameters
--full-user-name --hostname --image-index
@@ -2830,17 +2868,23 @@ _VBoxManage() {
--key --language --locale
--no-install-additions --no-install-txs
--package-selection-adjustment
--password-file --post-install-command
--post-install-template --script-template
--start-vm --time-zone --user
--user-password --validation-kit-iso)
_get_excluded_items "${items[@]}"
--post-install-command
--post-install-template --proxy
--script-template --start-vm --time-zone
--user --validation-kit-iso)
[[ " ${COMP_WORDS[*]} " != *" --admin-password "* &&
" ${COMP_WORDS[*]} " != *" --admin-password-file"* ]] &&
items+=( --admin-password-file --admin-password )
[[ " ${COMP_WORDS[*]} " != *" --user-password "* &&
" ${COMP_WORDS[*]} " != *" --user-password-file"* ]] &&
items+=( --user-password-file --user-password )
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
fi
;;
esac
fi
fi
;;
@@ -2949,7 +2993,6 @@ _VBoxManage() {
fi
fi
;;
esac
}
complete -o default -F _VBoxManage VBoxManage