mirror of
https://github.com/gryf/vboxmanage-bash-completion.git
synced 2025-12-19 04:20:25 +01:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9c5b048c62 | |||
| 5fd18d7cec | |||
| 05af06f337 | |||
| cde78c8e4c | |||
|
|
197c46cd35 | ||
|
|
296be19560 |
@@ -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.26, 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:
|
||||||
|
|||||||
39
VBoxManage
39
VBoxManage
@@ -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.26
|
||||||
|
|
||||||
_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,8 +1619,8 @@ _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)
|
||||||
|
|
||||||
if [[ ${prev} == ${cmd} ]]; then
|
if [[ ${prev} == ${cmd} ]]; then
|
||||||
@@ -1788,8 +1791,8 @@ _VBoxManage() {
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
--draganddrop)
|
--draganddrop)
|
||||||
COMPREPLY+=( $(compgen -W "disabled hosttoguest" \
|
COMPREPLY+=( $(compgen -W "disabled hosttoguest
|
||||||
-- ${cur}) )
|
guesttohost bidirectional" -- ${cur}) )
|
||||||
;;
|
;;
|
||||||
|
|
||||||
--vrdeextpack|--vrdeauthlibrary|--snapshotfolder|\
|
--vrdeextpack|--vrdeauthlibrary|--snapshotfolder|\
|
||||||
|
|||||||
Reference in New Issue
Block a user