From 9b06c430fdf8675aec55c22eff0a168954e23531 Mon Sep 17 00:00:00 2001 From: gryf Date: Sun, 8 Oct 2017 10:14:13 +0200 Subject: [PATCH] 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". --- README.rst | 2 +- VBoxManage | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/README.rst b/README.rst index 4feea21..e8920b1 100644 --- a/README.rst +++ b/README.rst @@ -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 -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 simple session with the VBoxManage command below, to have an idea how it works: diff --git a/VBoxManage b/VBoxManage index 038e45f..c6085eb 100644 --- a/VBoxManage +++ b/VBoxManage @@ -1,9 +1,10 @@ # bash command-line completion for VBoxManage command # # Author: Roman 'gryf' Dobosz -# URL: https://bitbucket.org/gryf/vboxmanage-bash-completion +# 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: 5.1.26 _VBoxManage() { local cur prev opts cmd subcommand tmp items name index result @@ -440,6 +441,10 @@ _VBoxManage() { sort | \ uniq) + # add debugvm command manually, since it's described differently in + # vboxmanage help + opts="${opts} debugvm" + if [[ ${cur} == "-q" || ${COMP_CWORD} -eq 1 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 @@ -805,9 +810,9 @@ _VBoxManage() { fi ;; - debugvm) + "debugvm") 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 _vms_comp runningvms else @@ -824,7 +829,7 @@ _VBoxManage() { _get_excluded_items "${items[@]}" COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) ;; - getregisters|setregisters) + getregisters|setregisters|stack) _get_excluded_items "--cpu" COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) ;; @@ -835,7 +840,7 @@ _VBoxManage() { COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) ;; statistics) - items=(--reset --pattern) + items=(--reset --pattern --descriptions) _get_excluded_items "${items[@]}" COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) ;; @@ -848,7 +853,6 @@ _VBoxManage() { COMPREPLY=( $(compgen -W "$result" -- ${cur}) ) ;; esac - _get_excluded_items "--descriptions" COMPREPLY+=( $(compgen -W "$result" -- ${cur}) ) else [[ "${prev}" == "--filename" ]] && \ @@ -989,10 +993,10 @@ _VBoxManage() { ;; guestcontrol) - local items=(run start copyfrom copyto mkdir createdir - createdirectory rmdir removedir removedirectory removefile rm mv - move ren rename mktemp createtemp createtemporary stat list - closeprocess closesession updatega updateguestadditions + local items=(run start copyfrom copyto mkdir createdir + createdirectory rmdir removedir removedirectory removefile rm mv + move ren rename mktemp createtemp createtemporary stat list + closeprocess closesession updatega updateguestadditions updateadditions watch) if [[ ${prev} == ${cmd} ]]; then