aboutsummaryrefslogtreecommitdiff
path: root/client/cmd.h
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-05-29 12:09:19 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-05-29 12:09:19 +0200
commit81cbd31a1a6a0e521ab262492245ec109c25ec8b (patch)
tree9678444b28e8fc932639edd4446b013a43945392 /client/cmd.h
parent8894d20ff0d1c1dde69879a21e756e01bcfa5262 (diff)
sort out completion functions
Diffstat (limited to 'client/cmd.h')
-rw-r--r--client/cmd.h33
1 files changed, 21 insertions, 12 deletions
diff --git a/client/cmd.h b/client/cmd.h
index 932f3a2..9c58fb6 100644
--- a/client/cmd.h
+++ b/client/cmd.h
@@ -2,24 +2,28 @@
#include <stddef.h>
-typedef void cmd_fn_t(char *);
+typedef void cmd_handle_t(char *);
+typedef char** cmd_complete_t(const char*, int, int);
struct cmd {
- void (* handle)(char *);
+ cmd_handle_t * handle;
const char* name;
const char* info;
- // TODO: tab completion function?
+ cmd_complete_t * complete;
};
+typedef struct cmd cmd_t;
-cmd_fn_t cmd_exit;
-cmd_fn_t cmd_test;
-cmd_fn_t cmd_help;
-cmd_fn_t cmd_status;
-cmd_fn_t cmd_reset;
-cmd_fn_t cmd_ls;
-cmd_fn_t cmd_send;
+cmd_handle_t cmd_exit;
+cmd_handle_t cmd_test;
+cmd_handle_t cmd_help;
+cmd_complete_t cmd_help_complete;
+cmd_handle_t cmd_status;
+cmd_handle_t cmd_reset;
+cmd_handle_t cmd_ls;
+cmd_handle_t cmd_send;
+cmd_handle_t cmd_skip;
-static const struct cmd cmds[] = {
+static const cmd_t cmds[] = {
{
.handle = cmd_exit,
.name = "exit",
@@ -43,7 +47,12 @@ static const struct cmd cmds[] = {
{
.handle = cmd_reset,
.name = "reset",
- .info = "reset entire game state",
+ .info = "set game state to 'idle' for one or more puzzle modules",
+ },
+ {
+ .handle = cmd_skip,
+ .name = "skip",
+ .info = "set game state to 'solved' for one or more puzzle modules",
},
{
.handle = cmd_ls,