mirror of
https://github.com/gryf/vboxmanage-bash-completion.git
synced 2025-12-17 19:40:17 +01:00
Changed a way how vboxmanage commands are obtained.
Starting from 7.x version of VirtualBox, vboxmanage command help gives its usage with one or more lines per command, like: VBoxManage command <args> [--option1|--option2] [--option3=optarg ] There is no need to get it as in old format from now on.
This commit is contained in:
16
VBoxManage
16
VBoxManage
@@ -484,21 +484,15 @@ _VBoxManage() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# all possible commands for the VBoxManage
|
# all possible commands for the VBoxManage. Starting from VirtualBox 7.x all
|
||||||
|
# commands are listed as ` VBoxManage commandname ` in a help.
|
||||||
opts=$(VBoxManage -q help | \
|
opts=$(VBoxManage -q help | \
|
||||||
grep -E -o "^\s\s[a-z]+ " | \
|
grep VBoxManage | \
|
||||||
grep -v VBoxManage | \
|
awk '{print $2}'| \
|
||||||
awk '{print $1}'| \
|
grep -v '\[' | \
|
||||||
sort | \
|
sort | \
|
||||||
uniq)
|
uniq)
|
||||||
|
|
||||||
# Add commands which are defined as ` VBoxManage commandname ` in a help.
|
|
||||||
opts="${opts} $(VBoxManage -q help | \
|
|
||||||
grep -E -o '^\s\s[a-zA-Z]+\s[a-z]+' | \
|
|
||||||
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}) )
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
Reference in New Issue
Block a user