1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-25 12:36:11 +03:00

debug command now serves as a frontend to get debug informations

This commit is contained in:
Maxime Coste 2014-03-31 20:07:35 +01:00
parent 60452d9745
commit 968922055b

View File

@ -2,6 +2,7 @@
#include "buffer.hh" #include "buffer.hh"
#include "buffer_manager.hh" #include "buffer_manager.hh"
#include "client.hh"
#include "client_manager.hh" #include "client_manager.hh"
#include "color_registry.hh" #include "color_registry.hh"
#include "command_manager.hh" #include "command_manager.hh"
@ -12,11 +13,11 @@
#include "file.hh" #include "file.hh"
#include "highlighter.hh" #include "highlighter.hh"
#include "highlighters.hh" #include "highlighters.hh"
#include "client.hh"
#include "option_manager.hh" #include "option_manager.hh"
#include "option_types.hh" #include "option_types.hh"
#include "parameters_parser.hh" #include "parameters_parser.hh"
#include "register_manager.hh" #include "register_manager.hh"
#include "remote.hh"
#include "shell_manager.hh" #include "shell_manager.hh"
#include "string.hh" #include "string.hh"
#include "user_interface.hh" #include "user_interface.hh"
@ -703,16 +704,19 @@ const CommandDesc echo_cmd = {
const CommandDesc debug_cmd = { const CommandDesc debug_cmd = {
"debug", "debug",
nullptr, nullptr,
"debug <params>...: write given parameters in the debug buffer", "debug <params>...: write debug informations in debug buffer",
ParameterDesc{ SwitchMap{}, ParameterDesc::Flags::SwitchesOnlyAtStart }, ParameterDesc{ SwitchMap{}, ParameterDesc::Flags::SwitchesOnlyAtStart, 1 },
CommandFlags::None, CommandFlags::None,
CommandCompleter{}, CommandCompleter{},
[](const ParametersParser& parser, Context&) [](const ParametersParser& parser, Context&)
{ {
String message; if (parser[0] == "info")
for (auto& param : parser) {
message += param + " "; write_debug("pid: " + to_string(getpid()));
write_debug(message); write_debug("session: " + Server::instance().session());
}
else
throw runtime_error("unknown debug command '" + parser[0] + "'");
} }
}; };