39 lines
884 B
C
39 lines
884 B
C
/**
|
|
* Copyright (c) 2025 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "dusk.h"
|
|
#include "consoledefs.h"
|
|
|
|
typedef struct consolecmd_s consolecmd_t;
|
|
|
|
typedef struct {
|
|
consolecmd_t *cmd;
|
|
char_t command[CONSOLE_LINE_MAX];
|
|
char_t argv[CONSOLE_CMD_ARGC_MAX][CONSOLE_LINE_MAX];
|
|
uint32_t argc;
|
|
} consolecmdexec_t;
|
|
|
|
typedef void (*consolecmdfunc_t)(const consolecmdexec_t *exec);
|
|
|
|
typedef struct consolecmd_s {
|
|
char_t name[CONSOLE_CMD_NAME_MAX];
|
|
consolecmdfunc_t function;
|
|
} consolecmd_t;
|
|
|
|
/**
|
|
* Initializes a console command.
|
|
*
|
|
* @param cmd Pointer to the console command.
|
|
* @param name The name of the command.
|
|
* @param function The function to execute when the command is called.
|
|
*/
|
|
void consoleCmdInit(
|
|
consolecmd_t *cmd,
|
|
const char_t *name,
|
|
consolecmdfunc_t function
|
|
); |