mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
show help when command not found
This commit is contained in:
@@ -119,7 +119,7 @@ Commands::Execution Commands::execute_command(Shell & shell, CommandLine && comm
|
||||
result.error = nullptr;
|
||||
|
||||
if (commands.exact.empty()) {
|
||||
result.error = "Command not found";
|
||||
result.error = "Command not found. Try 'help' for a list of commands.";
|
||||
} else if (commands.exact.count(longest->first) == 1) {
|
||||
auto & command = longest->second;
|
||||
std::vector<std::string> arguments;
|
||||
@@ -130,7 +130,7 @@ Commands::Execution Commands::execute_command(Shell & shell, CommandLine && comm
|
||||
command_line.reset();
|
||||
|
||||
if (commands.partial.upper_bound(longest->first) != commands.partial.end() && !arguments.empty()) {
|
||||
result.error = "Command not found";
|
||||
result.error = "Command not found. Try 'help' for a list of commands.";
|
||||
} else if (arguments.size() < command->minimum_arguments()) {
|
||||
result.error = "Not enough arguments for command";
|
||||
} else if (arguments.size() > command->maximum_arguments()) {
|
||||
|
||||
Reference in New Issue
Block a user