CommandManager: tweak naming

This commit is contained in:
Maxime Coste 2017-11-04 16:00:34 +08:00
parent 7f51e51fcb
commit 6bac767124
3 changed files with 13 additions and 13 deletions

View File

@ -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)
{

View File

@ -19,7 +19,7 @@ namespace Kakoune
class Context;
using CommandParameters = ConstArrayView<String>;
using Command = std::function<void (const ParametersParser& parser,
using CommandFunc = std::function<void (const ParametersParser& parser,
Context& context,
const ShellContext& shell_context)>;
@ -84,7 +84,7 @@ public:
bool command_defined(StringView command_name) const;
void register_command(String command_name, Command command,
void register_command(String command_name, CommandFunc func,
String docstring,
ParameterDesc param_desc,
CommandFlags flags = CommandFlags::None,
@ -101,16 +101,16 @@ private:
const ShellContext& shell_context,
DisplayCoord pos);
struct CommandDescriptor
struct Command
{
Command command;
CommandFunc func;
String docstring;
ParameterDesc param_desc;
CommandFlags flags;
CommandHelper helper;
CommandCompleter completer;
};
using CommandMap = HashMap<String, CommandDescriptor, MemoryDomain::Commands>;
using CommandMap = HashMap<String, Command, MemoryDomain::Commands>;
CommandMap m_commands;
String m_last_complete_command;
int m_command_depth = 0;

View File

@ -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"))
{