mirror of
https://github.com/gryf/vboxmanage-bash-completion.git
synced 2025-12-17 11:30:23 +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
|
||||
|
||||
# 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 | \
|
||||
grep -E -o "^\s\s[a-z]+ " | \
|
||||
grep -v VBoxManage | \
|
||||
awk '{print $1}'| \
|
||||
grep VBoxManage | \
|
||||
awk '{print $2}'| \
|
||||
grep -v '\[' | \
|
||||
sort | \
|
||||
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
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user