@@ -11,31 +11,13 @@ extern "C" {
11
11
12
12
#include <stdbool.h>
13
13
#include "esp_err.h"
14
+ #include "esp_linenoise.h"
14
15
15
16
/**
16
17
* @brief Handle to a REPL instance.
17
18
*/
18
19
typedef struct esp_repl_instance * esp_repl_instance_handle_t ;
19
20
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
-
39
21
/**
40
22
* @brief Function prototype called before executing a command.
41
23
*
@@ -55,25 +37,6 @@ typedef struct esp_repl_pre_executor {
55
37
void * ctx ; /**!< Context passed to the pre-executor function */
56
38
} esp_repl_pre_executor_t ;
57
39
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
-
77
40
/**
78
41
* @brief Function prototype called after executing a command.
79
42
*
@@ -133,13 +96,14 @@ typedef struct esp_repl_on_exit {
133
96
* @brief Configuration structure to initialize a REPL instance.
134
97
*/
135
98
typedef 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 */
143
107
} esp_repl_config_t ;
144
108
145
109
/**
0 commit comments