fixed unknown topic warning in the console
@@ -844,7 +844,7 @@ static void fileFound(void* data)
FREE(loadPublicCartData);
}
-static void printUsage(Console* console, const char* command);
+static bool printUsage(Console* console, const char* command);
static void onLoadCommandConfirmed(Console* console)
{
@@ -3092,7 +3092,7 @@ static void toUpperStr(char* str)
}
}
-static void printUsage(Console* console, const char* command)
+static bool printUsage(Console* console, const char* command)
{
FOR(const Command*, cmd, Commands)
{
@@ -3112,12 +3112,14 @@ static void printUsage(Console* console, const char* command)
}
printLine(console);
- break;
+ return true;
}
}
+
+ return false;
}
-static void printApi(Console* console, const char* param)
+static bool printApi(Console* console, const char* param)
{
FOR(const ApiItem*, api, Api)
{
@@ -3129,9 +3131,11 @@ static void printApi(Console* console, const char* param)
printFront(console, "\n\n");
printBack(console, api->help);
printLine(console);
- break;
+ return true;
}
}
+
+ return false;
}
#define STRBUF_SIZE(name, ...) + STRLEN(#name) + STRLEN(Sep)
@@ -3298,8 +3302,10 @@ static void onHelpCommand(Console* console)
{
const char* param = console->desc->params->key;
- printUsage(console, param);
- printApi(console, param);
+ if(printUsage(console, param)) return commandDone(console);
+ else if(printApi(console, param)) return commandDone(console);
+ else
+ {
static const struct Handler {const char* cmd; void(*handler)(Console*);} Handlers[] =
{
@@ -3312,8 +3318,8 @@ static void onHelpCommand(Console* console)
if(strcmp(ptr->cmd, param) == 0)
{
ptr->handler(console);
- commandDone(console);
- return;
+ return commandDone(console);
+ }
}
printError(console, "\nunknown topic: ");
