diff options
author | lonkaars <loek@pipeframe.xyz> | 2024-05-24 15:18:44 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2024-05-24 15:18:44 +0200 |
commit | 31c30df2a24a45c69a7c5c2f594fa3a9a835b1fb (patch) | |
tree | 59d86bac0175a2f6001d0a54aa8f42e43b27d474 /client/cmd.cpp | |
parent | b74efcf6c6badcc7dc1937d511a163108f9fac0f (diff) |
add tab completion + help function
Diffstat (limited to 'client/cmd.cpp')
-rw-r--r-- | client/cmd.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/client/cmd.cpp b/client/cmd.cpp index 99a4dd6..0a73dad 100644 --- a/client/cmd.cpp +++ b/client/cmd.cpp @@ -1,3 +1,4 @@ +#include <cstdio> #include <cstdlib> #include <string.h> @@ -13,3 +14,19 @@ void cmd_test(char*) { i2c_send(0x39, (char*) data, strlen(data)); } +void cmd_help(char*) { + printf("List of available commands:\n"); + for (size_t i = 0; i < cmds_length; i++) { + struct cmd cmd = cmds[i]; + printf(" %-*s", 10, cmd.name); + if (cmd.info != NULL) + printf(" %s", cmd.info); + printf("\n"); + } + + printf( + "\n" + "You can also use the TAB key to autocomplete commands\n" + ); +} + |