mirror of https://github.com/Icinga/icinga2.git
Merge pull request #5979 from Icinga/feature/enhance-console-5595
Add quit, exit and help
This commit is contained in:
commit
b88149c455
|
@ -135,7 +135,8 @@ void ConsoleCommand::BreakpointHandler(ScriptFrame& frame, ScriptError *ex, cons
|
|||
ShowCodeLocation(std::cout, di);
|
||||
|
||||
std::cout << "You can inspect expressions (such as variables) by entering them at the prompt.\n"
|
||||
<< "To leave the debugger and continue the program use \"$continue\".\n";
|
||||
<< "To leave the debugger and continue the program use \"$continue\".\n"
|
||||
<< "For further commands see \"$help\".\n";
|
||||
|
||||
#ifdef HAVE_EDITLINE
|
||||
rl_completion_entry_function = ConsoleCommand::ConsoleCompleteHelper;
|
||||
|
@ -240,7 +241,9 @@ int ConsoleCommand::Run(const po::variables_map& vm, const std::vector<std::stri
|
|||
scriptFrame.Self = scriptFrame.Locals;
|
||||
|
||||
if (!vm.count("eval") && !vm.count("file"))
|
||||
std::cout << "Icinga 2 (version: " << Application::GetAppVersion() << ")\n";
|
||||
std::cout << "Icinga 2 (version: " << Application::GetAppVersion() << ")\n"
|
||||
<< "Type $help to view available commands.\n";
|
||||
|
||||
|
||||
const char *addrEnv = getenv("ICINGA2_API_URL");
|
||||
if (addrEnv)
|
||||
|
@ -392,10 +395,18 @@ incomplete:
|
|||
line = commandOnce;
|
||||
|
||||
if (!line.empty() && line[0] == '$') {
|
||||
if (line == "$continue")
|
||||
if (line == "$continue" || line == "$quit" || line == "$exit")
|
||||
break;
|
||||
else if (line == "$help")
|
||||
std::cout << "Welcome to the Icinga 2 debug console.\n"
|
||||
"Usable commands:\n"
|
||||
" $continue Continue running Icinga 2 (script debugger).\n"
|
||||
" $quit, $exit Stop debugging and quit the console.\n"
|
||||
" $help Print this help.\n\n"
|
||||
"For more information on how to use this console, please consult the documentation at https://icinga.com/docs\n";
|
||||
else
|
||||
std::cout << "Unknown debugger command: " << line << "\n";
|
||||
|
||||
std::cout << "Unknown debugger command: " << line << "\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue