add automatic shutdown after confirming a server stop
This commit is contained in:
@@ -81,6 +81,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)
|
||||
{
|
||||
string request = AnsiConsole.Prompt(new TextPrompt<string>("MCM > "));
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user