From 8d24768d5d0d2eaa49ed1487b83c4526112d89b2 Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Sat, 17 Jun 2017 11:27:07 +0300 Subject: src: Add a `commands` debug flag This commit allows setting the `commands` flag to the `debug` option, in order to have the engine write on the *debug* buffer the commands that are being executed, along with their arguments. --- src/command_manager.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/command_manager.cc') diff --git a/src/command_manager.cc b/src/command_manager.cc index 6ab012d1..4d422feb 100644 --- a/src/command_manager.cc +++ b/src/command_manager.cc @@ -9,6 +9,7 @@ #include "utils.hh" #include "optional.hh" #include "containers.hh" +#include "buffer_utils.hh" #include @@ -443,6 +444,16 @@ void CommandManager::execute_single_command(CommandParameters params, if (command_it == m_commands.end()) throw command_not_found(params[0]); + const DebugFlags debug_flags = context.options()["debug"].get(); + if (debug_flags & DebugFlags::Commands) + { + String repr_parameters; + + for (auto repr_param : param_view) + repr_parameters += " " + repr_param; + write_to_debug_buffer(format("command {}{}", params[0], repr_parameters)); + } + try { ParametersParser parameter_parser(param_view, -- cgit v1.2.3