InteractivePrompt icon indicating copy to clipboard operation
InteractivePrompt copied to clipboard

Request for exit conditions

Open BillSobel opened this issue 6 years ago • 1 comments

Would it be possible for the call to exit the Run loop (Environment.Exit(0)) today to instead be a lamda. Im my case I ideally do not want the process to exit, just exit the command shell. On the same vane, could the Run lamda have a way to indicate that the run loop should exit so exit/quit etc commands can be implemented in addition to the escape key?

BillSobel avatar Oct 25 '19 21:10 BillSobel

Proposed changes:

                    if (lastKey.Key == ConsoleKey.Escape)
                        return; // Environment.Exit(0);

            var result = lambda(cmd, input, completionList);
            if (result.Output != null) Console.Write(result.Output);
            if (result.Continue == false) return;

With the processing lamda returning (bool Continue, string Output) vs just the string it does today.

BillSobel avatar Oct 25 '19 21:10 BillSobel