Tweak option documentation helper to support -add

Fixes #1939
This commit is contained in:
Maxime Coste 2018-03-19 03:04:50 +11:00
parent 126dd11ba8
commit 9518f279fb

View File

@ -1244,10 +1244,11 @@ const CommandDesc source_cmd = {
static String option_doc_helper(const Context& context, CommandParameters params)
{
if (params.size() < 2)
const bool add = params.size() > 1 and params[0] == "-add";
if (params.size() < 2 + (add ? 1 : 0))
return "";
auto desc = GlobalScope::instance().option_registry().option_desc(params[1]);
auto desc = GlobalScope::instance().option_registry().option_desc(params[1 + (add ? 1 : 0)]);
if (not desc or desc->docstring().empty())
return "";