mirror of
https://github.com/gryf/vboxmanage-bash-completion.git
synced 2025-12-19 04:20:25 +01:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9c5b048c62 | |||
| 5fd18d7cec | |||
| 05af06f337 | |||
| cde78c8e4c | |||
|
|
197c46cd35 | ||
|
|
296be19560 | ||
| 62f57ebbb7 |
@@ -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
|
||||
5.2.14, and supports all commands (in some extent ;)).
|
||||
5.2.26, and supports all commands (in some extent ;)).
|
||||
|
||||
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:
|
||||
|
||||
42
VBoxManage
42
VBoxManage
@@ -4,7 +4,7 @@
|
||||
# URL: https://bitbucket.org/gryf/vboxmanage-bash-completion
|
||||
# URL: https://github.com/gryf/vboxmanage-bash-completion
|
||||
# License: 3-clause BSD-style license (see LICENSE file)
|
||||
# Version: 5.2.14
|
||||
# Version: 5.2.26
|
||||
|
||||
_VBoxManage() {
|
||||
local cur prev opts cmd subcommand tmp items name index result
|
||||
@@ -271,11 +271,14 @@ _VBoxManage() {
|
||||
snap=$(VBoxManage snapshot "${name//\\/}" \
|
||||
list | \
|
||||
grep UUID |
|
||||
awk -F ': ' '{print $2}' | \
|
||||
sed 's/ (.*//' | \
|
||||
tr '\n' '|' | \
|
||||
sed 's/|$//' | \
|
||||
sed 's/\s/\\ /g')
|
||||
awk -F ': *' -v ORS='|' '/UUID: / {
|
||||
n=$2; u=$3
|
||||
sub(/..UUID/, "", n)
|
||||
gsub(/ /, "\\ ", n);
|
||||
sub(/[)].*/, "", u)
|
||||
print n; print u
|
||||
}'
|
||||
)
|
||||
IFS='|' read -ra snap <<< "$snap"
|
||||
|
||||
for item in "${snap[@]}"
|
||||
@@ -683,8 +686,8 @@ _VBoxManage() {
|
||||
;;
|
||||
draganddrop)
|
||||
[[ ${prev} == "draganddrop" ]] && \
|
||||
COMPREPLY=( $(compgen -W "disabled
|
||||
hosttoguest" -- ${cur}) )
|
||||
COMPREPLY=( $(compgen -W "disabled hosttoguest
|
||||
guesttohost bidirectional" -- ${cur}) )
|
||||
;;
|
||||
vrde|videocap)
|
||||
[[ ${prev} == "vrde" ||
|
||||
@@ -1029,8 +1032,8 @@ _VBoxManage() {
|
||||
--ignore-operhaned-processes --profile
|
||||
--dos2unix --unix2dos --username --domain --)
|
||||
|
||||
[[ " ${comp_words[@]} " != *" --password "* ||
|
||||
" ${comp_words[@]} " != *" --passwordfile "* ]] &&
|
||||
[[ " ${COMP_WORDS[@]} " != *" --password "* ||
|
||||
" ${COMP_WORDS[@]} " != *" --passwordfile "* ]] &&
|
||||
items+=(--passwordfile --password)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --putenv "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -E "* ]] &&
|
||||
@@ -1057,8 +1060,8 @@ _VBoxManage() {
|
||||
--ignore-operhaned-processes --profile
|
||||
--username --domain --passwordfile --password --)
|
||||
|
||||
[[ " ${comp_words[@]} " != *" --password "* ||
|
||||
" ${comp_words[@]} " != *" --passwordfile "* ]] &&
|
||||
[[ " ${COMP_WORDS[@]} " != *" --password "* ||
|
||||
" ${COMP_WORDS[@]} " != *" --passwordfile "* ]] &&
|
||||
items+=(--passwordfile --password)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --verbose "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -v "* ]] &&
|
||||
@@ -1078,8 +1081,8 @@ _VBoxManage() {
|
||||
[[ " ${COMP_WORDS[@]} " != *" --recursive "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -R "* ]] &&
|
||||
items+=(--recursive -R)
|
||||
[[ " ${comp_words[@]} " != *" --password "* ||
|
||||
" ${comp_words[@]} " != *" --passwordfile "* ]] &&
|
||||
[[ " ${COMP_WORDS[@]} " != *" --password "* ||
|
||||
" ${COMP_WORDS[@]} " != *" --passwordfile "* ]] &&
|
||||
items+=(--passwordfile --password)
|
||||
[[ " ${COMP_WORDS[@]} " != *" --verbose "* &&
|
||||
" ${COMP_WORDS[@]} " != *" -v "* ]] &&
|
||||
@@ -1616,8 +1619,9 @@ _VBoxManage() {
|
||||
--videocapmaxtime --videocapmaxsize --videocapopts --defaultfrontend
|
||||
--cpuid-portability-level --paravirtprovider --audiocodec --usbxhci
|
||||
--usbrename --apic --x2apic --paravirtdebug --cpu-profile
|
||||
--biosapic --videocapopts --ibpb-on-vm-entry --ibpb-on-vm-exit
|
||||
--spec-ctrl --audioin --audioout)
|
||||
--biosapic --ibpb-on-vm-entry --ibpb-on-vm-exit --spec-ctrl
|
||||
--audioin --audioout --l1d-flush-on-sched
|
||||
--l1d-flush-on-vm-entry)
|
||||
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
_vms_comp vms
|
||||
@@ -1658,7 +1662,7 @@ _VBoxManage() {
|
||||
--tracing-allow-vm-access|--usbcardreader|\
|
||||
--autostart-enabled|--videocap|--usbxhci|--apic|--x2apic|\
|
||||
--ibpb-on-vm-entry|--ibpb-on-vm-exit|--spec-ctrl|--audioin|\
|
||||
--audioout)
|
||||
--audioout|--l1d-flush-on-sched|--l1d-flush-on-vm-entry)
|
||||
COMPREPLY=( $(compgen -W "on off" -- ${cur}) )
|
||||
;;
|
||||
|
||||
@@ -1787,8 +1791,8 @@ _VBoxManage() {
|
||||
;;
|
||||
|
||||
--draganddrop)
|
||||
COMPREPLY+=( $(compgen -W "disabled hosttoguest" \
|
||||
-- ${cur}) )
|
||||
COMPREPLY+=( $(compgen -W "disabled hosttoguest
|
||||
guesttohost bidirectional" -- ${cur}) )
|
||||
;;
|
||||
|
||||
--vrdeextpack|--vrdeauthlibrary|--snapshotfolder|\
|
||||
|
||||
Reference in New Issue
Block a user