summaryrefslogtreecommitdiffstats
path: root/src/cmd.h
blob: df975dbc2d9244bd4fc07d8820eed157ce495e31 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#pragma once

#include <stdlib.h>
#include <stdbool.h>

typedef bool (*cmd_func)(const char *args);

struct cmd {
	const char *name;
	cmd_func func;
};

void cmd_init(void);
void cmd_deinit(void);

bool cmd_run(const char *name, bool *found);
bool cmd_rerun(void);

const struct cmd *cmd_get(const char *name);
const struct cmd *cmd_find(const char *name);

extern const struct cmd commands[];
extern const size_t command_count;