show commands has a verbose mode

This commit is contained in:
proddy
2021-05-09 10:59:03 +02:00
parent 81f4724d71
commit 0e67e8311e

View File

@@ -256,7 +256,7 @@ void EMSESPShell::add_console_commands() {
uint16_t offset = Helpers::hextoint(arguments.back().c_str()); uint16_t offset = Helpers::hextoint(arguments.back().c_str());
EMSESP::send_read_request(type_id, device_id, offset, EMS_MAX_TELEGRAM_LENGTH); EMSESP::send_read_request(type_id, device_id, offset, EMS_MAX_TELEGRAM_LENGTH);
} else { } else {
// send with length to send immediatly and trigger publish read_id // send with length to send immediately and trigger publish read_id
EMSESP::send_read_request(type_id, device_id, 0, EMS_MAX_TELEGRAM_LENGTH); EMSESP::send_read_request(type_id, device_id, 0, EMS_MAX_TELEGRAM_LENGTH);
} }
}); });
@@ -375,8 +375,8 @@ void EMSESPShell::add_console_commands() {
// validate the command // validate the command
if (arguments.size() < 2) { if (arguments.size() < 2) {
shell.print(F("Available commands are: ")); shell.print(F("Missing command. Available commands are: "));
Command::show(shell, device_type); Command::show(shell, device_type, false); // non-verbose mode
return; return;
} }
@@ -403,14 +403,13 @@ void EMSESPShell::add_console_commands() {
} }
if (ok && json.size()) { if (ok && json.size()) {
doc.shrinkToFit();
serializeJsonPretty(doc, shell); serializeJsonPretty(doc, shell);
shell.println(); shell.println();
return; return;
} else if (!ok) { } else if (!ok) {
shell.println(F("Unknown command, value, or id.")); shell.println(F("Unknown command, value, or id."));
shell.print(F("Available commands are: ")); shell.print(F("Available commands are: "));
Command::show(shell, device_type); Command::show(shell, device_type, false); // non-verbose mode
} }
}, },
[&](Shell & shell __attribute__((unused)), const std::vector<std::string> & arguments) -> std::vector<std::string> { [&](Shell & shell __attribute__((unused)), const std::vector<std::string> & arguments) -> std::vector<std::string> {