mirror of https://github.com/djcb/mu.git
server: show complete help by default
And add :terse to get a one-line description.
This commit is contained in:
parent
5922cd9fa2
commit
c8e8004f29
|
@ -667,13 +667,13 @@ static void
|
||||||
help_handler (Context& context, const Parameters& params)
|
help_handler (Context& context, const Parameters& params)
|
||||||
{
|
{
|
||||||
const auto command{get_symbol_or(params, ":command", "")};
|
const auto command{get_symbol_or(params, ":command", "")};
|
||||||
const auto full{get_bool_or(params, ":full")};
|
const auto terse{get_bool_or(params, ":terse", command.empty())};
|
||||||
|
|
||||||
if (command.empty()) {
|
if (command.empty()) {
|
||||||
std::cout << ";; Commands are s-expressions of the form\n"
|
std::cout << ";; Commands are s-expressions of the form\n"
|
||||||
<< ";; (<command-name> :param1 val1 :param2 val2 ...)\n"
|
<< ";; (<command-name> :param1 val1 :param2 val2 ...)\n"
|
||||||
<< ";; For instance:\n;; (help :command quit)\n"
|
<< ";; For instance:\n;; (help :command quit)\n"
|
||||||
<< ";; to get information about the 'quit' command\n;;\n";
|
<< ";; to get detailed information about the 'quit'\n;;\n";
|
||||||
std::cout << ";; The following commands are available:\n";
|
std::cout << ";; The following commands are available:\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -694,8 +694,7 @@ help_handler (Context& context, const Parameters& params)
|
||||||
else
|
else
|
||||||
std::cout << ";; " << name.c_str() << ": "
|
std::cout << ";; " << name.c_str() << ": "
|
||||||
<< info.docstring.c_str() << '\n';
|
<< info.docstring.c_str() << '\n';
|
||||||
|
if (terse)
|
||||||
if (!full)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (auto&& argname: info.sorted_argnames()) {
|
for (auto&& argname: info.sorted_argnames()) {
|
||||||
|
@ -1167,8 +1166,8 @@ make_command_map (Context& context)
|
||||||
CommandInfo{
|
CommandInfo{
|
||||||
ArgMap{ {":command", ArgInfo{Type::Symbol, false,
|
ArgMap{ {":command", ArgInfo{Type::Symbol, false,
|
||||||
"command to get information for" }},
|
"command to get information for" }},
|
||||||
{":full", ArgInfo{Type::Symbol, false,
|
{":terse", ArgInfo{Type::Symbol, false,
|
||||||
"whether to include information about parameters" }}},
|
"only show a short description" }}},
|
||||||
"get information about one or all commands",
|
"get information about one or all commands",
|
||||||
[&](const auto& params){help_handler(context, params);}});
|
[&](const auto& params){help_handler(context, params);}});
|
||||||
cmap.emplace("index",
|
cmap.emplace("index",
|
||||||
|
|
Loading…
Reference in New Issue