aboutsummaryrefslogtreecommitdiff
path: root/client/cmd.h
diff options
context:
space:
mode:
Diffstat (limited to 'client/cmd.h')
-rw-r--r--client/cmd.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/client/cmd.h b/client/cmd.h
new file mode 100644
index 0000000..509104a
--- /dev/null
+++ b/client/cmd.h
@@ -0,0 +1,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]);
+