mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-10 04:43:33 +00:00
console: make empty line behavior run-time configurable
This commit is contained in:
@@ -112,6 +112,9 @@ static void initialize_console(void)
|
||||
/* Set command history size */
|
||||
linenoiseHistorySetMaxLen(100);
|
||||
|
||||
/* Don't return empty lines */
|
||||
linenoiseAllowEmpty(false);
|
||||
|
||||
#if CONFIG_STORE_HISTORY
|
||||
/* Load command history from filesystem */
|
||||
linenoiseHistoryLoad(HISTORY_PATH);
|
||||
@@ -174,7 +177,7 @@ void app_main(void)
|
||||
break;
|
||||
}
|
||||
/* Add the command to the history if not empty*/
|
||||
if(strlen(line) > 0) {
|
||||
if (strlen(line) > 0) {
|
||||
linenoiseHistoryAdd(line);
|
||||
#if CONFIG_STORE_HISTORY
|
||||
/* Save command history to filesystem */
|
||||
@@ -197,8 +200,7 @@ void app_main(void)
|
||||
/* linenoise allocates line buffer on the heap, so need to free it */
|
||||
linenoiseFree(line);
|
||||
}
|
||||
|
||||
|
||||
ESP_LOGE(TAG, "Error or end-of-input, terminating console");
|
||||
esp_console_deinit();
|
||||
vTaskDelete(NULL); /* terminate app_main */
|
||||
}
|
||||
|
Reference in New Issue
Block a user