summaryrefslogtreecommitdiff
path: root/src/command_manager.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-02-12 09:02:09 +0000
committerMaxime Coste <frrrwww@gmail.com>2014-03-02 01:08:11 +0000
commit8ac19edf674382a33a7ab0acd1bd71175dfe9556 (patch)
tree59d205ac39e99d85231e8f5d2ef163410b097e6a /src/command_manager.cc
parente6f5b3c038b83803523c58ea03a770d14d10fbd8 (diff)
Add a docstring to commands
Diffstat (limited to 'src/command_manager.cc')
-rw-r--r--src/command_manager.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/command_manager.cc b/src/command_manager.cc
index a37105d1..622ab60a 100644
--- a/src/command_manager.cc
+++ b/src/command_manager.cc
@@ -18,21 +18,23 @@ bool CommandManager::command_defined(const String& command_name) const
void CommandManager::register_command(String command_name,
Command command,
+ String docstring,
ParameterDesc param_desc,
CommandFlags flags,
CommandCompleter completer)
{
- m_commands[command_name] = { std::move(command), std::move(param_desc), flags, std::move(completer) };
+ m_commands[command_name] = { std::move(command), std::move(docstring), std::move(param_desc), flags, std::move(completer) };
}
void CommandManager::register_commands(memoryview<String> command_names,
Command command,
+ String docstring,
ParameterDesc param_desc,
CommandFlags flags,
CommandCompleter completer)
{
kak_assert(not command_names.empty());
- m_commands[command_names[0]] = { std::move(command), std::move(param_desc), flags, completer };
+ m_commands[command_names[0]] = { std::move(command), std::move(docstring), std::move(param_desc), flags, completer };
for (size_t i = 1; i < command_names.size(); ++i)
m_aliases[command_names[i]] = command_names[0];
}
@@ -355,6 +357,8 @@ std::pair<String, String> CommandManager::command_info(const String& command_lin
return res;
res.first = cmd->first;
+ if (not cmd->second.docstring.empty())
+ res.second += cmd->second.docstring + "\n";
auto& switches = cmd->second.param_desc.switches;
if (not switches.empty())
{