add automatic shutdown after confirming a server stop

This commit is contained in:
2026-02-16 22:50:32 +00:00
parent 47d1baae27
commit 230757e945
+12
View File
@@ -81,6 +81,8 @@ public class RemoteServerSystem : Command<RemoteServerSystem.Settings>
AnsiConsole.MarkupLine("Enter QUIT or EXIT to exit."); AnsiConsole.MarkupLine("Enter QUIT or EXIT to exit.");
List<string> quitCmds = ["quit", "exit"]; List<string> quitCmds = ["quit", "exit"];
bool shouldAutoQuit = false;
while (true) while (true)
{ {
string request = AnsiConsole.Prompt(new TextPrompt<string>("MCM > ")); string request = AnsiConsole.Prompt(new TextPrompt<string>("MCM > "));
@@ -94,9 +96,19 @@ public class RemoteServerSystem : Command<RemoteServerSystem.Settings>
continue; continue;
} }
if (request == "stop")
{
shouldAutoQuit = true;
}
AnsiConsole.MarkupLine(client.SendCommand(request, out resp) AnsiConsole.MarkupLine(client.SendCommand(request, out resp)
? $"[royalblue1]{resp.Body.EscapeMarkup()}[/]" ? $"[royalblue1]{resp.Body.EscapeMarkup()}[/]"
: "[red]Error sending command.[/]"); : "[red]Error sending command.[/]");
if (shouldAutoQuit)
{
break;
}
} }
return 0; return 0;