9 Commits

Author SHA1 Message Date
c7a5fc729c Bump to version 6.1.38 2022-10-08 09:12:03 +02:00
62d9078b23 Version bump 2022-08-29 10:20:38 +02:00
3f42dd2dc1 Version bump. 2022-07-25 11:15:06 +02:00
6ee3136033 Version bump. 2022-07-25 11:14:24 +02:00
cf367c093d Bump to 6.1.28.
There was a minor change regarding export command: --iso parameter has
been removed.
2021-12-07 21:21:57 +01:00
7174fe03db Bump to version 6.1.22.
There were cloud network command added.
2021-08-01 17:40:51 +02:00
f2d71065cb Removed trailing spaces. 2021-08-01 17:39:56 +02:00
82e2fade6b Change approach with getting commands out of help.
There are currently two ways for specify available commands in
vboxmanage help:

Usage:

  VBoxManage [<general option>] <command>
[..]
Commands:

  command1 ...

  command2 ...

and:

  VBoxManage command3 ...

  VBoxManage command4 ...

besides the fact how it is annoying for parsing the output (or lack of
having some way for machine readable format for commands), I have
treated the latter as a exception from general rule, but lately it
slowly moving towards the second form. In this patch it is adapted to
also parse second format instead of adding those commands manually.

Also, there was missing parameter added for sharedfolder add command.
2021-07-27 20:10:58 +02:00
8360d95123 Bump to 6.1.10 2020-07-21 14:30:48 +02:00
2 changed files with 67 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
6.1.6, and should contain all commands and their options. 6.1.38, and should contain all commands and their options.
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: 6.1.6 # Version: 6.1.38
_VBoxManage() { _VBoxManage() {
@@ -453,7 +453,7 @@ _VBoxManage() {
[[ ${item^^} == ${cur^^}* ]] && COMPREPLY+=("$item") [[ ${item^^} == ${cur^^}* ]] && COMPREPLY+=("$item")
done done
} }
_cloudprofiles_comp() { _cloudprofiles_comp() {
local profiles local profiles
local item local item
@@ -486,16 +486,18 @@ _VBoxManage() {
# all possible commands for the VBoxManage # all possible commands for the VBoxManage
opts=$(VBoxManage -q help | \ opts=$(VBoxManage -q help | \
egrep -o "^\s\s[a-z]+ " | \ grep -E -o "^\s\s[a-z]+ " | \
grep -v VBoxManage | \ grep -v VBoxManage | \
awk '{print $1}'| \ awk '{print $1}'| \
sort | \ sort | \
uniq) uniq)
# Add some commands manually, since they are listed differently in # Add commands which are defined as ` VBoxManage commandname ` in a help.
# vboxmanage help. opts="${opts} $(VBoxManage -q help | \
opts="${opts} mediumio debugvm unattended extpack clonevm snapshot grep -E -o '^\s\s[a-zA-Z]+\s[a-z]+' | \
dhcpserver cloudprofile cloud" awk '{print $2}'| \
sort | \
uniq)"
if [[ ${cur} == "-q" || ${COMP_CWORD} -eq 1 ]] ; then if [[ ${cur} == "-q" || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
@@ -691,14 +693,19 @@ _VBoxManage() {
;; ;;
cloud) cloud)
if [[ " ${COMP_WORDS[@]} " != *" --provider"* || if [ "${prev}" == "cloud" ]; then
items=(--provider --profile network)
elif [[ " ${COMP_WORDS[@]} " == *" network"* ]]; then
items=(update delete info)
elif [[ " ${COMP_WORDS[@]} " != *" --provider"* ||
" ${COMP_WORDS[@]} " != *" --profile"* ]]; then " ${COMP_WORDS[@]} " != *" --profile"* ]]; then
items=(--provider --profile) items=(--provider --profile)
else else
[[ " ${COMP_WORDS[@]} " != *" list"* && [[ " ${COMP_WORDS[@]} " != *" list"* &&
" ${COMP_WORDS[@]} " != *" instance"* && " ${COMP_WORDS[@]} " != *" instance"* &&
" ${COMP_WORDS[@]} " != *" network"* &&
" ${COMP_WORDS[@]} " != *" image"* ]] && " ${COMP_WORDS[@]} " != *" image"* ]] &&
items=(list instance image) items=(list instance image network)
fi fi
_get_excluded_items "${items[@]}" _get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
@@ -715,14 +722,18 @@ _VBoxManage() {
COMPREPLY=( $(compgen -W "instances images" -- ${cur}) ) COMPREPLY=( $(compgen -W "instances images" -- ${cur}) )
;; ;;
instance) instance)
COMPREPLY=( $(compgen -W "create info terminate start COMPREPLY=( $(compgen -W "create info terminate start
pause" -- ${cur}) ) pause" -- ${cur}) )
;; ;;
image) image)
COMPREPLY=( $(compgen -W "create info delete import COMPREPLY=( $(compgen -W "create info delete import
export" -- ${cur}) ) export" -- ${cur}) )
;; ;;
network) # TODO: differentiate between setup/create and update/delete/info
if [[ " ${COMP_WORDS[@]} " == *" --provider"* ]]; then
COMPREPLY=( $(compgen -W "setup create" -- ${cur}) )
fi
;;
esac esac
if [[ " ${COMP_WORDS[@]} " == *" list images"* ]]; then if [[ " ${COMP_WORDS[@]} " == *" list images"* ]]; then
@@ -732,8 +743,9 @@ _VBoxManage() {
fi fi
if [[ " ${COMP_WORDS[@]} " == *" instance create"* ]]; then if [[ " ${COMP_WORDS[@]} " == *" instance create"* ]]; then
items=(--domain-name --display-name --shape --subnet --publicip items=( --domain-name --display-name --shape --subnet
--boot-disk-size --privateip --public-ssh-key --launch-mode) --publicip --boot-disk-size --privateip --public-ssh-key
--launch-mode --cloud-init-script-path )
[[ " ${COMP_WORDS[@]} " != *" --image-id"* && [[ " ${COMP_WORDS[@]} " != *" --image-id"* &&
" ${COMP_WORDS[@]} " != *" --boot-volume-id"* ]] && " ${COMP_WORDS[@]} " != *" --boot-volume-id"* ]] &&
items+=(--image-id --boot-volume-id) items+=(--image-id --boot-volume-id)
@@ -746,7 +758,7 @@ _VBoxManage() {
COMPREPLY=( $(compgen -W "true false" -- ${cur}) ) COMPREPLY=( $(compgen -W "true false" -- ${cur}) )
;; ;;
--launch-mode) --launch-mode)
COMPREPLY=( $(compgen -W "NATIVE EMULATED COMPREPLY=( $(compgen -W "NATIVE EMULATED
PARAVIRTUALIZED" -- ${cur}) ) PARAVIRTUALIZED" -- ${cur}) )
;; ;;
esac esac
@@ -757,7 +769,7 @@ _VBoxManage() {
" ${COMP_WORDS[@]} " == *" instance pause"* ]]; then " ${COMP_WORDS[@]} " == *" instance pause"* ]]; then
COMPREPLY=( $(compgen -W "--id" -- ${cur}) ) COMPREPLY=( $(compgen -W "--id" -- ${cur}) )
fi fi
if [[ " ${COMP_WORDS[@]} " == *" image create"* ]]; then if [[ " ${COMP_WORDS[@]} " == *" image create"* ]]; then
items=(--display-name --bucket-name --object-name --instance-id) items=(--display-name --bucket-name --object-name --instance-id)
@@ -769,13 +781,41 @@ _VBoxManage() {
COMPREPLY=( $(compgen -W "--id" -- ${cur}) ) COMPREPLY=( $(compgen -W "--id" -- ${cur}) )
fi fi
if [[ " ${COMP_WORDS[@]} " == *" image import"* ]]; then if [[ " ${COMP_WORDS[@]} " == *" image import"* ]]; then
COMPREPLY=( $(compgen -W "--id --bucket-name COMPREPLY=( $(compgen -W "--id --bucket-name
--object-name" -- ${cur}) ) --object-name" -- ${cur}) )
fi fi
if [[ " ${COMP_WORDS[@]} " == *" image export"* ]]; then if [[ " ${COMP_WORDS[@]} " == *" image export"* ]]; then
COMPREPLY=( $(compgen -W "--id --display-name --bucket-name COMPREPLY=( $(compgen -W "--id --display-name --bucket-name
--object-name" -- ${cur}) ) --object-name" -- ${cur}) )
fi fi
if [[ " ${COMP_WORDS[@]} " == *" network setup"* ]]; then
items=( --local-gateway-iso --gateway-os-name
--gateway-os-version --gateway-shape --tunnel-network-name
--tunnel-network-range --guest-additions-iso --proxy
--compartment-id )
_get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
fi
if [[ " ${COMP_WORDS[@]} " == *" network create"* ]]; then
items=( --name --network-id )
[[ " ${COMP_WORDS[@]} " != *" --enable"* &&
" ${COMP_WORDS[@]} " != *" --disable"* ]] &&
items+=(--enable --disable)
_get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
fi
if [[ " ${COMP_WORDS[@]} " == *" network update"* ]]; then
items=( --name --network-id )
[[ " ${COMP_WORDS[@]} " != *" --enable"* &&
" ${COMP_WORDS[@]} " != *" --disable"* ]] &&
items+=(--enable --disable)
_get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
fi
if [[ " ${COMP_WORDS[@]} " == *" network info"* ||
" ${COMP_WORDS[@]} " == *" network delete"* ]]; then
COMPREPLY=( $(compgen -W "--name" -- ${cur}) )
fi
;; ;;
controlvm) controlvm)
@@ -1230,7 +1270,7 @@ _VBoxManage() {
;; ;;
"export") "export")
items=( --manifest --iso --options --vsys --cloud ) items=( --manifest --options --vsys --cloud --cloudinitscriptpath )
if [[ ${prev} == ${cmd} ]]; then if [[ ${prev} == ${cmd} ]]; then
_vms_comp vms _vms_comp vms
elif [[ ${prev} == "--eulafile" ]]; then elif [[ ${prev} == "--eulafile" ]]; then
@@ -1256,7 +1296,7 @@ _VBoxManage() {
items+=(--vmname --cloudprofile --cloudshape --clouddomain items+=(--vmname --cloudprofile --cloudshape --clouddomain
--clouddisksize --cloudbucket --cloudocivcn --cloudocisubnet --clouddisksize --cloudbucket --cloudocivcn --cloudocisubnet
--cloudkeepobject --cloudlaunchinstance --cloudpublicip --cloudkeepobject --cloudlaunchinstance --cloudpublicip
--cloudprivateip --cloudlaunchmode) --cloudprivateip --cloudlaunchmode --cloudinitscriptpath )
_get_excluded_items "${items[@]}" _get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
@@ -2172,6 +2212,12 @@ _VBoxManage() {
COMPREPLY=( $(compgen -W "default flat low normal high" \ COMPREPLY=( $(compgen -W "default flat low normal high" \
-- ${cur}) ) -- ${cur}) )
;; ;;
--recordingscreens)
COMPREPLY=( $(compgen -W "all none" \
-- ${cur}) )
;;
esac esac
fi fi
;; ;;
@@ -2304,7 +2350,7 @@ _VBoxManage() {
case "${subcommand}" in case "${subcommand}" in
add) add)
items=(--name --hostpath --transient --readonly items=(--name --hostpath --transient --readonly
--automount) --automount --auto-mount-point)
_get_excluded_items "${items[@]}" _get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
;; ;;