@@ -11,31 +11,13 @@ extern "C" {
1111
1212#include <stdbool.h>
1313#include "esp_err.h"
14+ #include "esp_linenoise.h"
1415
1516/**
1617 * @brief Handle to a REPL instance.
1718 */
1819typedef struct esp_repl_instance * esp_repl_instance_handle_t ;
1920
20- /**
21- * @brief Function prototype for reading input for the REPL.
22- *
23- * @param ctx User-defined context pointer.
24- * @param buf Buffer to store the read data.
25- * @param buf_size Size of the buffer in bytes.
26- *
27- * @return ESP_OK on success, error code otherwise.
28- */
29- typedef esp_err_t (* esp_repl_reader_fn )(void * ctx , char * buf , size_t buf_size );
30-
31- /**
32- * @brief Reader configuration structure for the REPL.
33- */
34- typedef struct esp_repl_reader {
35- esp_repl_reader_fn func ; /**!< Function to read input */
36- void * ctx ; /**!< Context passed to the reader function */
37- } esp_repl_reader_t ;
38-
3921/**
4022 * @brief Function prototype called before executing a command.
4123 *
@@ -55,25 +37,6 @@ typedef struct esp_repl_pre_executor {
5537 void * ctx ; /**!< Context passed to the pre-executor function */
5638} esp_repl_pre_executor_t ;
5739
58- /**
59- * @brief Function prototype to execute a REPL command.
60- *
61- * @param ctx User-defined context pointer.
62- * @param buf Null-terminated command string.
63- * @param ret_val Pointer to store the command return value.
64- *
65- * @return ESP_OK on success, error code otherwise.
66- */
67- typedef esp_err_t (* esp_repl_executor_fn )(void * ctx , const char * buf , int * ret_val );
68-
69- /**
70- * @brief Executor configuration structure for the REPL.
71- */
72- typedef struct esp_repl_executor {
73- esp_repl_executor_fn func ; /**!< Function to execute commands */
74- void * ctx ; /**!< Context passed to the executor function */
75- } esp_repl_executor_t ;
76-
7740/**
7841 * @brief Function prototype called after executing a command.
7942 *
@@ -133,13 +96,14 @@ typedef struct esp_repl_on_exit {
13396 * @brief Configuration structure to initialize a REPL instance.
13497 */
13598typedef struct esp_repl_config {
136- size_t max_cmd_line_size ; /**!< Maximum allowed command line size */
137- esp_repl_reader_t reader ; /**!< Reader callback and context */
138- esp_repl_pre_executor_t pre_executor ; /**!< Pre-executor callback and context */
139- esp_repl_executor_t executor ; /**!< Executor callback and context */
140- esp_repl_post_executor_t post_executor ; /**!< Post-executor callback and context */
141- esp_repl_on_stop_t on_stop ; /**!< Stop callback and context */
142- esp_repl_on_exit_t on_exit ; /**!< Exit callback and context */
99+ esp_linenoise_handle_t linenoise_handle ; /**!< Handle to the esp_linenoise instance */
100+ esp_commands_handle_t command_set_handle ; /**!< Handle to a set of commands */
101+ size_t max_cmd_line_size ; /**!< Maximum allowed command line size */
102+ const char * history_save_path ; /**!< Path to file to save the history */
103+ esp_repl_pre_executor_t pre_executor ; /**!< Pre-executor callback and context */
104+ esp_repl_post_executor_t post_executor ; /**!< Post-executor callback and context */
105+ esp_repl_on_stop_t on_stop ; /**!< Stop callback and context */
106+ esp_repl_on_exit_t on_exit ; /**!< Exit callback and context */
143107} esp_repl_config_t ;
144108
145109/**
0 commit comments