diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2014-03-31 20:07:35 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2014-03-31 20:07:35 +0100 |
| commit | 968922055bae8321e59f70ac0c015b6fa6fc2e65 (patch) | |
| tree | a23c5e0483ca94d355dc928db91ebc71f150f150 /src | |
| parent | 60452d9745ec356e247fedc468847954686934d2 (diff) | |
debug command now serves as a frontend to get debug informations
Diffstat (limited to 'src')
| -rw-r--r-- | src/commands.cc | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/commands.cc b/src/commands.cc index a77c8dbb..316c4bc2 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -2,6 +2,7 @@ #include "buffer.hh" #include "buffer_manager.hh" +#include "client.hh" #include "client_manager.hh" #include "color_registry.hh" #include "command_manager.hh" @@ -12,11 +13,11 @@ #include "file.hh" #include "highlighter.hh" #include "highlighters.hh" -#include "client.hh" #include "option_manager.hh" #include "option_types.hh" #include "parameters_parser.hh" #include "register_manager.hh" +#include "remote.hh" #include "shell_manager.hh" #include "string.hh" #include "user_interface.hh" @@ -703,16 +704,19 @@ const CommandDesc echo_cmd = { const CommandDesc debug_cmd = { "debug", nullptr, - "debug <params>...: write given parameters in the debug buffer", - ParameterDesc{ SwitchMap{}, ParameterDesc::Flags::SwitchesOnlyAtStart }, + "debug <params>...: write debug informations in debug buffer", + ParameterDesc{ SwitchMap{}, ParameterDesc::Flags::SwitchesOnlyAtStart, 1 }, CommandFlags::None, CommandCompleter{}, [](const ParametersParser& parser, Context&) { - String message; - for (auto& param : parser) - message += param + " "; - write_debug(message); + if (parser[0] == "info") + { + write_debug("pid: " + to_string(getpid())); + write_debug("session: " + Server::instance().session()); + } + else + throw runtime_error("unknown debug command '" + parser[0] + "'"); } }; |
