Skip to content

Commit 0051ae9

Browse files
committed
fix(vmm): show vmm subcommands in top-level help output
1 parent 9600b62 commit 0051ae9

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

vmm/src/vmm-cli.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,6 +1549,23 @@ def main():
15491549
"vmm_id", help="VMM instance ID (prefix match supported)"
15501550
)
15511551

1552+
# Register nested subcommands for top-level help display
1553+
_nested_commands = {
1554+
'vmm ls': 'List all running VMM instances on this host',
1555+
'vmm switch': 'Switch active VMM instance',
1556+
}
1557+
1558+
# Patch parser's format_help to show nested subcommands
1559+
_orig_format_help = parser.format_help
1560+
def _patched_format_help():
1561+
text = _orig_format_help()
1562+
# Append nested subcommands after the subparser listing
1563+
extra = "\nnested commands:\n"
1564+
for cmd, desc in _nested_commands.items():
1565+
extra += f" {cmd:<24s}{desc}\n"
1566+
return text + extra
1567+
parser.format_help = _patched_format_help
1568+
15521569
# List command
15531570
lsvm_parser = subparsers.add_parser("lsvm", help="List VMs")
15541571
lsvm_parser.add_argument(

0 commit comments

Comments
 (0)