From 449bd68fab3e67b414a8ed606d7d65b6e6579674 Mon Sep 17 00:00:00 2001 From: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com> Date: Wed, 16 Jul 2025 00:06:44 +0100 Subject: [PATCH] Add instance restart to ctl --- packages/ctl/src/commands.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/ctl/src/commands.ts b/packages/ctl/src/commands.ts index 5da90701..3255b881 100644 --- a/packages/ctl/src/commands.ts +++ b/packages/ctl/src/commands.ts @@ -1038,17 +1038,32 @@ instanceCommands.add(new lib.Command({ definition: ["start ", "Start instance", (yargs) => { yargs.positional("instance", { describe: "Instance to start", type: "string" }); yargs.options({ - "save": { describe: "Save load, defaults to latest", nargs: 1, type: "string" }, + "save": { describe: "Save to load, defaults to latest", nargs: 1, type: "string" }, "keep-open": { describe: "Keep console open", nargs: 0, type: "boolean", default: false }, }); }], handler: async function(args: { instance: string, save?: string, keepOpen: boolean }, control: Control) { - let instanceId = await lib.resolveInstance(control, args.instance); + const instanceId = await lib.resolveInstance(control, args.instance); await control.setLogSubscriptions({ instanceIds: [instanceId] }); await control.sendTo({ instanceId }, new lib.InstanceStartRequest(args.save)); control.keepOpen = args.keepOpen; }, })); +instanceCommands.add(new lib.Command({ + definition: ["restart ", "Restart instance", (yargs) => { + yargs.positional("instance", { describe: "Instance to restart", type: "string" }); + yargs.options({ + "save": { describe: "Save to load, defaults to latest", nargs: 1, type: "string" }, + "keep-open": { describe: "Keep console open", nargs: 0, type: "boolean", default: false }, + }); + }], + handler: async function(args: { instance: string, save?: string, keepOpen: boolean }, control: Control) { + const instanceId = await lib.resolveInstance(control, args.instance); + await control.setLogSubscriptions({ instanceIds: [instanceId] }); + await control.sendTo({ instanceId }, new lib.InstanceRestartRequest(args.save)); + control.keepOpen = args.keepOpen; + }, +})); instanceCommands.add(new lib.Command({ definition: ["load-scenario ", "Start instance by loading a scenario", (yargs) => {