7 Commits

Author SHA1 Message Date
1be3e589d4 Bump to 5.2.32 version 2019-09-16 07:24:42 +02:00
9c5b048c62 Bump to 5.2.26
Added guesttohost and bidirectional parameters for --draganddrop option
for both: controlvm and modifyvm.
2019-04-23 19:14:39 +02:00
5fd18d7cec Removed redundant --videocapopts from modifyvm 2019-04-23 19:14:39 +02:00
05af06f337 Merge pull request #7 from schplurtz/comp_words
change comp_words to upper case
2019-02-19 19:21:21 +01:00
cde78c8e4c Merge pull request #6 from schplurtz/snaplist
handle snapshot completion entirely with awk
2019-02-19 19:19:39 +01:00
Schplurtz le Déboulonné
197c46cd35 change comp_words to upper case 2019-02-19 10:58:37 +01:00
Christophe Martin
296be19560 handle snapshot completion entirely with awk
fixes #5
Also list and complete snapshot uuid.
2019-02-19 10:41:23 +01:00
2 changed files with 25 additions and 21 deletions

View File

@@ -6,7 +6,7 @@ script. However, in some point of time I've decided to rewrite it almost from
scratch. scratch.
Current version of script was written and tested against VBoxManage in version Current version of script was written and tested against VBoxManage in version
5.2.22, and supports all commands (in some extent ;)). 5.2.32, and supports all commands (in some extent ;)).
Unlike other attempts, I've tried to make the script context aware. See the 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: simple session with the VBoxManage command below, to have an idea how it works:

View File

@@ -4,7 +4,7 @@
# URL: https://bitbucket.org/gryf/vboxmanage-bash-completion # URL: https://bitbucket.org/gryf/vboxmanage-bash-completion
# URL: https://github.com/gryf/vboxmanage-bash-completion # URL: https://github.com/gryf/vboxmanage-bash-completion
# License: 3-clause BSD-style license (see LICENSE file) # License: 3-clause BSD-style license (see LICENSE file)
# Version: 5.2.22 # Version: 5.2.32
_VBoxManage() { _VBoxManage() {
local cur prev opts cmd subcommand tmp items name index result local cur prev opts cmd subcommand tmp items name index result
@@ -271,11 +271,14 @@ _VBoxManage() {
snap=$(VBoxManage snapshot "${name//\\/}" \ snap=$(VBoxManage snapshot "${name//\\/}" \
list | \ list | \
grep UUID | grep UUID |
awk -F ': ' '{print $2}' | \ awk -F ': *' -v ORS='|' '/UUID: / {
sed 's/ (.*//' | \ n=$2; u=$3
tr '\n' '|' | \ sub(/..UUID/, "", n)
sed 's/|$//' | \ gsub(/ /, "\\ ", n);
sed 's/\s/\\ /g') sub(/[)].*/, "", u)
print n; print u
}'
)
IFS='|' read -ra snap <<< "$snap" IFS='|' read -ra snap <<< "$snap"
for item in "${snap[@]}" for item in "${snap[@]}"
@@ -683,8 +686,8 @@ _VBoxManage() {
;; ;;
draganddrop) draganddrop)
[[ ${prev} == "draganddrop" ]] && \ [[ ${prev} == "draganddrop" ]] && \
COMPREPLY=( $(compgen -W "disabled COMPREPLY=( $(compgen -W "disabled hosttoguest
hosttoguest" -- ${cur}) ) guesttohost bidirectional" -- ${cur}) )
;; ;;
vrde|videocap) vrde|videocap)
[[ ${prev} == "vrde" || [[ ${prev} == "vrde" ||
@@ -1029,8 +1032,8 @@ _VBoxManage() {
--ignore-operhaned-processes --profile --ignore-operhaned-processes --profile
--dos2unix --unix2dos --username --domain --) --dos2unix --unix2dos --username --domain --)
[[ " ${comp_words[@]} " != *" --password "* || [[ " ${COMP_WORDS[@]} " != *" --password "* ||
" ${comp_words[@]} " != *" --passwordfile "* ]] && " ${COMP_WORDS[@]} " != *" --passwordfile "* ]] &&
items+=(--passwordfile --password) items+=(--passwordfile --password)
[[ " ${COMP_WORDS[@]} " != *" --putenv "* && [[ " ${COMP_WORDS[@]} " != *" --putenv "* &&
" ${COMP_WORDS[@]} " != *" -E "* ]] && " ${COMP_WORDS[@]} " != *" -E "* ]] &&
@@ -1057,8 +1060,8 @@ _VBoxManage() {
--ignore-operhaned-processes --profile --ignore-operhaned-processes --profile
--username --domain --passwordfile --password --) --username --domain --passwordfile --password --)
[[ " ${comp_words[@]} " != *" --password "* || [[ " ${COMP_WORDS[@]} " != *" --password "* ||
" ${comp_words[@]} " != *" --passwordfile "* ]] && " ${COMP_WORDS[@]} " != *" --passwordfile "* ]] &&
items+=(--passwordfile --password) items+=(--passwordfile --password)
[[ " ${COMP_WORDS[@]} " != *" --verbose "* && [[ " ${COMP_WORDS[@]} " != *" --verbose "* &&
" ${COMP_WORDS[@]} " != *" -v "* ]] && " ${COMP_WORDS[@]} " != *" -v "* ]] &&
@@ -1078,8 +1081,8 @@ _VBoxManage() {
[[ " ${COMP_WORDS[@]} " != *" --recursive "* && [[ " ${COMP_WORDS[@]} " != *" --recursive "* &&
" ${COMP_WORDS[@]} " != *" -R "* ]] && " ${COMP_WORDS[@]} " != *" -R "* ]] &&
items+=(--recursive -R) items+=(--recursive -R)
[[ " ${comp_words[@]} " != *" --password "* || [[ " ${COMP_WORDS[@]} " != *" --password "* ||
" ${comp_words[@]} " != *" --passwordfile "* ]] && " ${COMP_WORDS[@]} " != *" --passwordfile "* ]] &&
items+=(--passwordfile --password) items+=(--passwordfile --password)
[[ " ${COMP_WORDS[@]} " != *" --verbose "* && [[ " ${COMP_WORDS[@]} " != *" --verbose "* &&
" ${COMP_WORDS[@]} " != *" -v "* ]] && " ${COMP_WORDS[@]} " != *" -v "* ]] &&
@@ -1616,9 +1619,9 @@ _VBoxManage() {
--videocapmaxtime --videocapmaxsize --videocapopts --defaultfrontend --videocapmaxtime --videocapmaxsize --videocapopts --defaultfrontend
--cpuid-portability-level --paravirtprovider --audiocodec --usbxhci --cpuid-portability-level --paravirtprovider --audiocodec --usbxhci
--usbrename --apic --x2apic --paravirtdebug --cpu-profile --usbrename --apic --x2apic --paravirtdebug --cpu-profile
--biosapic --videocapopts --ibpb-on-vm-entry --ibpb-on-vm-exit --biosapic --ibpb-on-vm-entry --ibpb-on-vm-exit --spec-ctrl
--spec-ctrl --audioin --audioout --l1d-flush-on-sched --audioin --audioout --l1d-flush-on-sched
--l1d-flush-on-vm-entry) --l1d-flush-on-vm-entry --mds-clear-on-sched --mds-clear-on-vm-entry)
if [[ ${prev} == ${cmd} ]]; then if [[ ${prev} == ${cmd} ]]; then
_vms_comp vms _vms_comp vms
@@ -1659,7 +1662,8 @@ _VBoxManage() {
--tracing-allow-vm-access|--usbcardreader|\ --tracing-allow-vm-access|--usbcardreader|\
--autostart-enabled|--videocap|--usbxhci|--apic|--x2apic|\ --autostart-enabled|--videocap|--usbxhci|--apic|--x2apic|\
--ibpb-on-vm-entry|--ibpb-on-vm-exit|--spec-ctrl|--audioin|\ --ibpb-on-vm-entry|--ibpb-on-vm-exit|--spec-ctrl|--audioin|\
--audioout|--l1d-flush-on-sched|--l1d-flush-on-vm-entry) --audioout|--l1d-flush-on-sched|--l1d-flush-on-vm-entry|\
--mds-clear-on-sched|--mds-clear-on-vm-entry)
COMPREPLY=( $(compgen -W "on off" -- ${cur}) ) COMPREPLY=( $(compgen -W "on off" -- ${cur}) )
;; ;;
@@ -1788,8 +1792,8 @@ _VBoxManage() {
;; ;;
--draganddrop) --draganddrop)
COMPREPLY+=( $(compgen -W "disabled hosttoguest" \ COMPREPLY+=( $(compgen -W "disabled hosttoguest
-- ${cur}) ) guesttohost bidirectional" -- ${cur}) )
;; ;;
--vrdeextpack|--vrdeauthlibrary|--snapshotfolder|\ --vrdeextpack|--vrdeauthlibrary|--snapshotfolder|\