aboutsummaryrefslogtreecommitdiff
path: root/client/cmd.h
blob: 509104a50067eb40a005077aca631eb1a6ae6b31 (plain)
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 <stddef.h>

typedef void cmd_fn_t(char *);

struct cmd {
	const char* name;
	void (* handle)(char *);
	const char* info;
	// TODO: tab completion function?
};

cmd_fn_t cmd_exit;
cmd_fn_t cmd_test;

static const struct cmd cmds[] = {
	(struct cmd){ .name = "exit", .handle = cmd_exit, .info = NULL, },
	(struct cmd){ .name = "test", .handle = cmd_test, .info = NULL, },
};

static const size_t cmds_length = sizeof(cmds) / sizeof(cmds[0]);