1/*
2 * Copyright 2012, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5
6
7#include "CliQuitCommand.h"
8
9#include <String.h>
10
11#include "CliContext.h"
12
13
14CliQuitCommand::CliQuitCommand()
15	:
16	CliCommand("quit Debugger",
17		"%s\n"
18		"Quits Debugger.")
19{
20}
21
22
23void
24CliQuitCommand::Execute(int argc, const char* const* argv, CliContext& context)
25{
26	// Ask the user what to do with the debugged team.
27	printf("Kill or resume the debugged team?\n");
28	for (;;) {
29		const char* line = context.PromptUser("(k)ill, (r)esume, (c)ancel? ");
30		if (line == NULL)
31			return;
32
33		BString trimmedLine(line);
34		trimmedLine.Trim();
35
36		if (trimmedLine == "k") {
37			context.QuitSession(true);
38			break;
39		}
40
41		if (trimmedLine == "r") {
42			context.QuitSession(false);
43			break;
44		}
45
46		if (trimmedLine == "c")
47			break;
48	}
49}
50