Improve readability of command docstrings by changing formatting
Fixes #1378
This commit is contained in:
parent
6101138606
commit
261e0fabcc
|
@ -538,26 +538,19 @@ Optional<CommandInfo> CommandManager::command_info(const Context& context, Strin
|
||||||
}
|
}
|
||||||
String helpstr = cmd->value.helper(context, params);
|
String helpstr = cmd->value.helper(context, params);
|
||||||
if (not helpstr.empty())
|
if (not helpstr.empty())
|
||||||
{
|
res.info += format("{}\n", helpstr);
|
||||||
if (helpstr.back() != '\n')
|
|
||||||
helpstr += '\n';
|
|
||||||
res.info += helpstr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String aliases;
|
String aliases;
|
||||||
for (auto& alias : context.aliases().aliases_for(cmd->key))
|
for (auto& alias : context.aliases().aliases_for(cmd->key))
|
||||||
aliases += " " + alias;
|
aliases += " " + alias;
|
||||||
if (not aliases.empty())
|
if (not aliases.empty())
|
||||||
res.info += "Aliases:" + aliases + "\n";
|
res.info += format("Aliases:{}\n", aliases);
|
||||||
|
|
||||||
|
|
||||||
auto& switches = cmd->value.param_desc.switches;
|
auto& switches = cmd->value.param_desc.switches;
|
||||||
if (not switches.empty())
|
if (not switches.empty())
|
||||||
{
|
res.info += format("Switches:\n{}", indent(generate_switches_doc(switches)));
|
||||||
res.info += "Switches:\n";
|
|
||||||
res.info += generate_switches_doc(switches);
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1222,7 +1222,7 @@ static String option_doc_helper(const Context& context, CommandParameters params
|
||||||
if (not desc or desc->docstring().empty())
|
if (not desc or desc->docstring().empty())
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
return format("{}: {}", desc->name(), desc->docstring());
|
return format("{}:\n{}", desc->name(), indent(desc->docstring()));
|
||||||
}
|
}
|
||||||
|
|
||||||
static OptionManager& get_options(StringView scope, const Context& context, StringView option_name)
|
static OptionManager& get_options(StringView scope, const Context& context, StringView option_name)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user