* Move the libedit interface there and provide nicer to use methods. * Also start adding utility methods for the input loop. It is going to manage all interactions of the input loop with outside events. * Fix the "quit" command. The user is now prompted what to do with the debugged team and the input loop thread avoids reentering the input loop.
50 lines
837 B
C++
50 lines
837 B
C++
/*
|
|
* Copyright 2012, Ingo Weinhold, [email protected].
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
|
|
|
|
#include "CliQuitCommand.h"
|
|
|
|
#include <String.h>
|
|
|
|
#include "CliContext.h"
|
|
|
|
|
|
CliQuitCommand::CliQuitCommand()
|
|
:
|
|
CliCommand("quit Debugger",
|
|
"%s\n"
|
|
"Quits Debugger.")
|
|
{
|
|
}
|
|
|
|
|
|
void
|
|
CliQuitCommand::Execute(int argc, const char* const* argv, CliContext& context)
|
|
{
|
|
// Ask the user what to do with the debugged team.
|
|
printf("Kill or resume the debugged team?\n");
|
|
for (;;) {
|
|
const char* line = context.PromptUser("(k)ill, (r)esume, (c)ancel? ");
|
|
if (line == NULL)
|
|
return;
|
|
|
|
BString trimmedLine(line);
|
|
trimmedLine.Trim();
|
|
|
|
if (trimmedLine == "k") {
|
|
context.QuitSession(true);
|
|
break;
|
|
}
|
|
|
|
if (trimmedLine == "r") {
|
|
context.QuitSession(false);
|
|
break;
|
|
}
|
|
|
|
if (trimmedLine == "d")
|
|
break;
|
|
}
|
|
}
|