feat(system/console): add help command verbose level option

Support users to demonstrate command info in different verbose levels.

Closes https://github.com/espressif/esp-idf/issues/9158
This commit is contained in:
Xiaoyu Liu
2024-05-17 18:09:32 +08:00
parent ea2f512cb5
commit 18f6be771d
4 changed files with 176 additions and 4 deletions

View File

@@ -130,6 +130,12 @@ typedef struct {
#define ESP_CONSOLE_DEV_USB_SERIAL_JTAG_CONFIG_DEFAULT() {}
#endif // CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG || (defined __DOXYGEN__ && SOC_USB_SERIAL_JTAG_SUPPORTED)
typedef enum {
ESP_CONSOLE_HELP_VERBOSE_LEVEL_0 = 0,
ESP_CONSOLE_HELP_VERBOSE_LEVEL_1 = 1,
ESP_CONSOLE_HELP_VERBOSE_LEVEL_MAX_NUM = 2
} esp_console_help_verbose_level_e;
/**
* @brief initialize console module
* @param config console configuration
@@ -314,6 +320,18 @@ const char *esp_console_get_hint(const char *buf, int *color, int *bold);
*/
esp_err_t esp_console_register_help_command(void);
/**
* @brief Set the verbose level for 'help' command
*
* Set the verbose level for 'help' command. Higher verbose level shows more details.
* Valid verbose_level values are described in esp_console_help_verbose_level_e and must be lower than `ESP_CONSOLE_HELP_VERBOSE_LEVEL_MAX_NUM`.
*
* @return
* - ESP_OK on success
* - ESP_ERR_INVALID_ARG, if invalid verbose level is provided
*/
esp_err_t esp_console_set_help_verbose_level(esp_console_help_verbose_level_e verbose_level);
/******************************************************************************
* Console REPL
******************************************************************************/