add cli ref to command function

This commit is contained in:
Laila van Reenen 2024-07-01 19:32:46 +02:00
parent f08c8e5788
commit 8261e605bc
Signed by: LailaTheElf
GPG Key ID: 1F4E6EE3E6DDF769
3 changed files with 4 additions and 2 deletions

View File

@ -173,7 +173,7 @@ int tryExecute(CLI_t* cli, FIFOBuffChar_t* fifo)
#ifdef HISTORY
History_put(cli->History, line);
#endif
int ret = (*(cmd->fn))(line);
int ret = (*(cmd->fn))(line, cli);
if (ret != INT_MIN)
{

View File

@ -39,6 +39,8 @@ extern void CLI_PrintHistory(CLI_t* cli);
// to recive a single caracter
bool CLI_charIn(CLI_t* cli, char c);
void CLI_charOut_save(CLI_t* cli, char ch);
void CLI_stringOut(CLI_t* cli, char* str);
#endif

View File

@ -3,7 +3,7 @@
typedef struct CMD_t {
char* cmd;
int (*fn)(char* line);
int (*fn)(char* line, void* cli);
} CMD_t;
typedef struct CMDList_s {