gryf 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
2016-03-06 13:56:57 +01:00
2020-07-21 14:30:48 +02:00

VBoxManage bash completion script

This version of the completion was initially based on Sebastian T. Hafner 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 6.1.10, 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:

VBoxManage session

Note, that startvm command proposes only VMs, which are not running, while controlvm will complete only running VMs.

What is worth to mention, this completion script is a real thing, so it only offer things which have sense for particular commands, for example:

Take a snapshot

For snapshot take subcommand, the only options which are proposed are --live and --description. Other commands and subcommands are behaving in similar way.

Installation

Either source the file:

$ . /path/to/this/repo/VBoxManage

or add it to a proper place depending on your distribution. Usual place would be:

  • ~/bash-completion.d/

  • /usr/local/etc/bash-completion.d/

  • /etc/bash_completion.d/

  • etc.

It's also okay to copy it into some directory, and place proper line in .profile or .bashrc:

source /some/directory/VBoxManage

License

This software is licensed under 3-clause BSD license. See LICENSE file for details.

Description