Files
haiku-beta6/src/apps/debugger/user_interface/cli/CliQuitCommand.cpp
T
Ingo Weinhold 8fe9f8b2d0 Debugger CLI: Move more stuff to and extend CliContext
* 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.
2012-07-27 23:42:01 +02:00

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;
}
}