From dbffcb226b95aad0d7a56a7e4982747d5bb58241 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 12 Apr 2013 14:22:01 +0200 Subject: [PATCH] echo command can take a -col parameter to specify the colors to use --- src/commands.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/commands.cc b/src/commands.cc index 15409b08..df2fd74a 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -432,10 +432,14 @@ void define_command(const CommandParameters& params, Context& context) void echo_message(const CommandParameters& params, Context& context) { + ParametersParser parser(params, { { "col", true } }, + ParametersParser::Flags::OptionsOnlyAtStart); String message; - for (auto& param : params) + for (auto& param : parser) message += param + " "; - context.print_status({ std::move(message), get_color("StatusLine") } ); + ColorPair color = get_color(parser.has_option("col") ? + parser.option_value("col") : "StatusLine"); + context.print_status({ std::move(message), color } ); } void write_debug_message(const CommandParameters& params, Context&)