From 6bac767124a1e8b776b7169f2cae6dde245cc195 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sat, 4 Nov 2017 16:00:34 +0800 Subject: [PATCH] CommandManager: tweak naming --- src/command_manager.cc | 10 +++++----- src/command_manager.hh | 14 +++++++------- src/commands.cc | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/command_manager.cc b/src/command_manager.cc index 2a1e865f..a8e58aad 100644 --- a/src/command_manager.cc +++ b/src/command_manager.cc @@ -22,14 +22,14 @@ bool CommandManager::command_defined(StringView command_name) const } void CommandManager::register_command(String command_name, - Command command, + CommandFunc func, String docstring, ParameterDesc param_desc, CommandFlags flags, CommandHelper helper, CommandCompleter completer) { - m_commands[command_name] = { std::move(command), + m_commands[command_name] = { std::move(func), std::move(docstring), std::move(param_desc), flags, @@ -411,8 +411,8 @@ String expand(StringView str, const Context& context, struct command_not_found : runtime_error { - command_not_found(StringView command) - : runtime_error(command + " : no such command") {} + command_not_found(StringView name) + : runtime_error(name + " : no such command") {} }; CommandManager::CommandMap::const_iterator @@ -458,7 +458,7 @@ void CommandManager::execute_single_command(CommandParameters params, { ParametersParser parameter_parser(param_view, command_it->value.param_desc); - command_it->value.command(parameter_parser, context, shell_context); + command_it->value.func(parameter_parser, context, shell_context); } catch (runtime_error& error) { diff --git a/src/command_manager.hh b/src/command_manager.hh index eb1fadb3..d3ecab18 100644 --- a/src/command_manager.hh +++ b/src/command_manager.hh @@ -19,9 +19,9 @@ namespace Kakoune class Context; using CommandParameters = ConstArrayView; -using Command = std::function; +using CommandFunc = std::function; using CommandCompleter = std::function; + using CommandMap = HashMap; CommandMap m_commands; String m_last_complete_command; int m_command_depth = 0; diff --git a/src/commands.cc b/src/commands.cc index 761fc665..1b691ed1 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -845,7 +845,7 @@ void define_command(const ParametersParser& parser, Context& context, const Shel flags = CommandFlags::Hidden; const String& commands = parser[1]; - Command cmd; + CommandFunc cmd; ParameterDesc desc; if (auto params = parser.get_switch("params")) {