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
@@ -80,6 +80,8 @@ public class RemoteServerSystem : Command<RemoteServerSystem.Settings>
AnsiConsole.MarkupLine("Enter QUIT or EXIT to exit.");
List<string> quitCmds = ["quit", "exit"];
bool shouldAutoQuit = false;
while (true)
{
@@ -94,9 +96,19 @@ public class RemoteServerSystem : Command<RemoteServerSystem.Settings>
continue;
}
if (request == "stop")
{
shouldAutoQuit = true;
}
AnsiConsole.MarkupLine(client.SendCommand(request, out resp)
? $"[royalblue1]{resp.Body.EscapeMarkup()}[/]"
: "[red]Error sending command.[/]");
if (shouldAutoQuit)
{
break;
}
}
return 0;