mirror of
https://github.com/gryf/vboxmanage-bash-completion.git
synced 2025-12-18 12:00:19 +01:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c051a4ed9d | |||
|
|
593ec245e5 | ||
| e681abb354 | |||
| cd90fc60bd | |||
| 28553da42d | |||
| 3efab392c1 | |||
| b0352554bb | |||
|
|
95088850b6 | ||
| 3404afa441 |
@@ -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
|
||||
7.0.10, and should contain all commands and their options.
|
||||
7.0.22, 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:
|
||||
@@ -42,6 +42,7 @@ be:
|
||||
* ~/bash-completion.d/
|
||||
* /usr/local/etc/bash-completion.d/
|
||||
* /etc/bash_completion.d/
|
||||
* ~/.local/share/bash-completion
|
||||
* etc.
|
||||
|
||||
It's also okay to copy it into some directory, and place proper line in
|
||||
|
||||
26
VBoxManage
26
VBoxManage
@@ -1,10 +1,9 @@
|
||||
# bash command-line completion for VBoxManage command
|
||||
#
|
||||
# Author: Roman 'gryf' Dobosz <gryf73@gmail.com>
|
||||
# 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: 7.0.10
|
||||
# Version: 7.0.22
|
||||
|
||||
|
||||
_VBoxManage() {
|
||||
@@ -164,8 +163,8 @@ _VBoxManage() {
|
||||
compopt -o filenames
|
||||
|
||||
vms=$(VBoxManage list vms -l | \
|
||||
egrep '^Name|State' | \
|
||||
egrep -B1 'State:\s+saved' | \
|
||||
grep -E '^Name|State' | \
|
||||
grep -E -B1 'State:\s+saved' | \
|
||||
grep Name |$VBMC_SED 's/Name:\s\+//' | \
|
||||
tr '\n' '|' | \
|
||||
$VBMC_SED 's/|$//' | \
|
||||
@@ -199,7 +198,7 @@ _VBoxManage() {
|
||||
local item
|
||||
|
||||
list=$(VBoxManage list ostypes | \
|
||||
egrep ^ID: | \
|
||||
grep -E ^ID: | \
|
||||
$VBMC_SED 's/ID:\s\+//' | \
|
||||
tr '\n' '|' | \
|
||||
$VBMC_SED 's/|$//')
|
||||
@@ -234,7 +233,7 @@ _VBoxManage() {
|
||||
local item
|
||||
|
||||
list=$(VBoxManage list hostonlyifs | \
|
||||
egrep ^Name: | \
|
||||
grep -E ^Name: | \
|
||||
$VBMC_SED 's/Name:\s\+//' | \
|
||||
$VBMC_SED 's/\s/\\ /g'| \
|
||||
tr '\n' '|' | \
|
||||
@@ -377,7 +376,7 @@ _VBoxManage() {
|
||||
local item
|
||||
|
||||
list=$(VBoxManage list bridgedifs | \
|
||||
egrep ^Name: | \
|
||||
grep -E ^Name: | \
|
||||
$VBMC_SED 's/Name:\s\+//' | \
|
||||
$VBMC_SED 's/\s/\\ /g'| \
|
||||
tr '\n' '|' | \
|
||||
@@ -395,7 +394,7 @@ _VBoxManage() {
|
||||
local item
|
||||
|
||||
list=$(VBoxManage list intnets| \
|
||||
egrep ^Name: | \
|
||||
grep -E ^Name: | \
|
||||
$VBMC_SED 's/Name:\s\+//' | \
|
||||
$VBMC_SED 's/\s/\\ /g'| \
|
||||
tr '\n' '|' | \
|
||||
@@ -938,7 +937,7 @@ _VBoxManage() {
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
;;
|
||||
changeuartmode[1-2])
|
||||
tmp=(disconnected server client tcpserver tcpclient
|
||||
tmp=(disconnected server client tcpserver tcpclient
|
||||
file device-name)
|
||||
_get_excluded_items "${tmp[@]}"
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
@@ -1046,7 +1045,7 @@ _VBoxManage() {
|
||||
;;
|
||||
|
||||
createvm)
|
||||
items=( --basefolder --cipher --default --group --name --ostype
|
||||
items=( --basefolder --cipher --default --groups --name --ostype
|
||||
--password-id --password --register --uuid )
|
||||
if [[ ${prev} == ${cmd} ]]; then
|
||||
COMPREPLY=( $(compgen -W "${items[*]}" -- ${cur}) )
|
||||
@@ -1055,7 +1054,7 @@ _VBoxManage() {
|
||||
COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
|
||||
|
||||
case "${prev}" in
|
||||
--group)
|
||||
--groups)
|
||||
COMPREPLY=()
|
||||
_group_comp
|
||||
;;
|
||||
@@ -2864,4 +2863,9 @@ _VBoxManage() {
|
||||
complete -o default -F _VBoxManage VBoxManage
|
||||
complete -o default -F _VBoxManage vboxmanage
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" != 'VBoxManage' &&
|
||||
"${BASH_SOURCE[0]}" != 'vboxmanage' ]]; then
|
||||
complete -o default -F _VBoxManage $(basename "${BASH_SOURCE[0]}")
|
||||
fi
|
||||
|
||||
# vim: set ft=sh tw=80 sw=4 et :
|
||||
|
||||
Reference in New Issue
Block a user