Skip to content

Commit 9600b62

Browse files
committed
refactor(vmm): change ls-vmm/switch-vmm to vmm ls/vmm switch subcommands
Group VMM instance management commands under a 'vmm' subcommand: vmm-cli.py vmm ls (was: vmm-cli.py ls-vmm) vmm-cli.py vmm switch (was: vmm-cli.py switch-vmm)
1 parent 22baf91 commit 9600b62

1 file changed

Lines changed: 21 additions & 12 deletions

File tree

vmm/src/vmm-cli.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,18 +1527,25 @@ def main():
15271527

15281528
subparsers = parser.add_subparsers(dest="command", help="Commands")
15291529

1530-
# VMM discovery commands
1531-
ls_vmm_parser = subparsers.add_parser(
1532-
"ls-vmm", help="List all running VMM instances on this host"
1530+
# VMM discovery commands (vmm ls / vmm switch)
1531+
vmm_parser = subparsers.add_parser(
1532+
"vmm", help="VMM instance management (ls, switch)"
15331533
)
1534-
ls_vmm_parser.add_argument(
1534+
vmm_subparsers = vmm_parser.add_subparsers(
1535+
dest="vmm_command", help="VMM sub-commands"
1536+
)
1537+
1538+
vmm_ls_parser = vmm_subparsers.add_parser(
1539+
"ls", help="List all running VMM instances on this host"
1540+
)
1541+
vmm_ls_parser.add_argument(
15351542
"--json", action="store_true", help="Output in JSON format"
15361543
)
15371544

1538-
switch_vmm_parser = subparsers.add_parser(
1539-
"switch-vmm", help="Switch active VMM instance"
1545+
vmm_switch_parser = vmm_subparsers.add_parser(
1546+
"switch", help="Switch active VMM instance"
15401547
)
1541-
switch_vmm_parser.add_argument(
1548+
vmm_switch_parser.add_argument(
15421549
"vmm_id", help="VMM instance ID (prefix match supported)"
15431550
)
15441551

@@ -1889,11 +1896,13 @@ def main():
18891896
args = parser.parse_args()
18901897

18911898
# Handle discovery commands before creating CLI (they don't need a connection)
1892-
if args.command == "ls-vmm":
1893-
cmd_ls_vmm(args)
1894-
return
1895-
elif args.command == "switch-vmm":
1896-
cmd_switch_vmm(args)
1899+
if args.command == "vmm":
1900+
if args.vmm_command == "ls":
1901+
cmd_ls_vmm(args)
1902+
elif args.vmm_command == "switch":
1903+
cmd_switch_vmm(args)
1904+
else:
1905+
vmm_parser.print_help()
18971906
return
18981907

18991908
# Resolve the URL with auto-discovery

0 commit comments

Comments
 (0)