From 1ed6000dd2a995bcd67e99b1c89aa1e2c4a6f1e6 Mon Sep 17 00:00:00 2001 From: Albert Cervin Date: Wed, 3 Apr 2024 11:43:49 +0200 Subject: Add completion to execute Completes on the command, not on following arguments if written directly at the prompt. --- src/dged/command.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/dged/command.c') diff --git a/src/dged/command.c b/src/dged/command.c index 9144058..2775286 100644 --- a/src/dged/command.c +++ b/src/dged/command.c @@ -63,6 +63,14 @@ int32_t execute_command(struct command *command, struct commands *commands, argc, argv); } +void commands_for_each(struct commands *commands, + void (*callback)(struct command *, void *), + void *userdata) { + HASHMAP_FOR_EACH(&commands->commands, struct command_entry * entry) { + callback(&entry->value, userdata); + } +} + void command_ctx_push_arg(struct command_ctx *ctx, const char *argv) { if (ctx->saved_argc < 64) { ctx->saved_argv[ctx->saved_argc] = strdup(argv); -- cgit v1.2.3