From 0858b95c408a07318b17e0e8ad1b84c3cfc9f104 Mon Sep 17 00:00:00 2001 From: myk002 Date: Fri, 22 Jul 2022 17:45:48 -0700 Subject: [PATCH] print help from helpdb on CR_WRONG_USAGE --- library/Core.cpp | 6 +++++- library/PluginManager.cpp | 2 -- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/library/Core.cpp b/library/Core.cpp index 9b4b065a1..12675054c 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -1197,7 +1197,11 @@ command_result Core::runCommand(color_ostream &con, const std::string &first_, v else { res = plug_mgr->InvokeCommand(con, first, parts); - if(res == CR_NOT_IMPLEMENTED) + if (res == CR_WRONG_USAGE) + { + help_helper(con, first); + } + else if (res == CR_NOT_IMPLEMENTED) { string completed; string filename = findScript(first + ".lua"); diff --git a/library/PluginManager.cpp b/library/PluginManager.cpp index a1b1bd293..223abfeac 100644 --- a/library/PluginManager.cpp +++ b/library/PluginManager.cpp @@ -503,8 +503,6 @@ command_result Plugin::invoke(color_ostream &out, const std::string & command, s { cr = cmd.function(out, parameters); } - if (cr == CR_WRONG_USAGE && !cmd.usage.empty()) - out << "Usage:\n" << cmd.usage << flush; break; } }