echo command accepts -debug switch to write to the debug buffer

This commit is contained in:
Maxime Coste 2014-03-31 20:07:02 +01:00
parent 030b248a30
commit 60452d9745

View File

@ -677,7 +677,8 @@ const CommandDesc echo_cmd = {
nullptr, nullptr,
"echo <params>...: display given parameters in the status line", "echo <params>...: display given parameters in the status line",
ParameterDesc{ ParameterDesc{
SwitchMap{ { "color", { true, "set message color" } } }, SwitchMap{ { "color", { true, "set message color" } },
{ "debug", { false, "write to debug buffer instead of status line" } } },
ParameterDesc::Flags::SwitchesOnlyAtStart ParameterDesc::Flags::SwitchesOnlyAtStart
}, },
CommandFlags::None, CommandFlags::None,
@ -687,9 +688,14 @@ const CommandDesc echo_cmd = {
String message; String message;
for (auto& param : parser) for (auto& param : parser)
message += param + " "; message += param + " ";
ColorPair color = get_color(parser.has_option("color") ? if (parser.has_option("debug"))
parser.option_value("color") : "StatusLine"); write_debug(message);
context.print_status({ std::move(message), color } ); else
{
auto color = get_color(parser.has_option("color") ?
parser.option_value("color") : "StatusLine");
context.print_status({ std::move(message), color } );
}
} }
}; };