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.");
|
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;
|
||||||
|
|||||||
Reference in New Issue
Block a user