From 80f70c74a72aff1727636a1d9f0c7766fbcb9f5b Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Thu, 16 Sep 2021 16:07:19 +0200 Subject: [PATCH] vsh: Add completer for '--command' of 'help' command Wrap 'vshReadlineCommandGenerator' into a function with proper prototype to provide a completer for the help command. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- tools/vsh.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/vsh.c b/tools/vsh.c index 9c6783dad1..cf24586b25 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -3026,9 +3026,20 @@ vshDeinit(vshControl *ctl) * Generic commands available to use by any client * ----------------------------------------------- */ + +static char ** +vshCompleteHelpCommand(vshControl *ctl G_GNUC_UNUSED, + const vshCmd *cmd G_GNUC_UNUSED, + unsigned int completerflags G_GNUC_UNUSED) +{ + return vshReadlineCommandGenerator(); +} + + const vshCmdOptDef opts_help[] = { {.name = "command", .type = VSH_OT_STRING, + .completer = vshCompleteHelpCommand, .help = N_("Prints global help, command specific help, or help for a group of related commands") }, {.name = NULL}