Added new subcommand for debugvm

VBoxManage removed "debug" from list of commands in help, leaving only
description for "debugvm" in section "Introspection and guest debugging"
below all of the list, so that it is needed for adding "debugvm" to the
list of available commands manually.

Also "stack", new subcommand was added to "debugvm".
This commit is contained in:
2017-10-08 10:14:13 +02:00
parent fbdd259cac
commit 9b06c430fd
2 changed files with 15 additions and 11 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
5.0.40, and supports all commands (in some extent ;)). 5.1.26, and supports all commands (in some extent ;)).
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,6 +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: 5.1.26
_VBoxManage() { _VBoxManage() {
local cur prev opts cmd subcommand tmp items name index result local cur prev opts cmd subcommand tmp items name index result
@@ -440,6 +441,10 @@ _VBoxManage() {
sort | \ sort | \
uniq) uniq)
# add debugvm command manually, since it's described differently in
# vboxmanage help
opts="${opts} debugvm"
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
@@ -805,9 +810,9 @@ _VBoxManage() {
fi fi
;; ;;
debugvm) "debugvm")
items=(dumpguestcore info injectnmi log logdest logflags osdetect items=(dumpguestcore info injectnmi log logdest logflags osdetect
osinfo osdmesg getregisters setregisters show statistics) osinfo osdmesg getregisters setregisters show statistics stack)
if [[ ${prev} == ${cmd} ]]; then if [[ ${prev} == ${cmd} ]]; then
_vms_comp runningvms _vms_comp runningvms
else else
@@ -824,7 +829,7 @@ _VBoxManage() {
_get_excluded_items "${items[@]}" _get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
;; ;;
getregisters|setregisters) getregisters|setregisters|stack)
_get_excluded_items "--cpu" _get_excluded_items "--cpu"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
;; ;;
@@ -835,7 +840,7 @@ _VBoxManage() {
COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
;; ;;
statistics) statistics)
items=(--reset --pattern) items=(--reset --pattern --descriptions)
_get_excluded_items "${items[@]}" _get_excluded_items "${items[@]}"
COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
;; ;;
@@ -848,7 +853,6 @@ _VBoxManage() {
COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) COMPREPLY=( $(compgen -W "$result" -- ${cur}) )
;; ;;
esac esac
_get_excluded_items "--descriptions"
COMPREPLY+=( $(compgen -W "$result" -- ${cur}) ) COMPREPLY+=( $(compgen -W "$result" -- ${cur}) )
else else
[[ "${prev}" == "--filename" ]] && \ [[ "${prev}" == "--filename" ]] && \