From: Peter Krempa Date: Thu, 16 Sep 2021 14:07:19 +0000 (+0200) Subject: vsh: Add completer for '--command' of 'help' command X-Git-Tag: v7.8.0-rc1~170 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80f70c74a72aff1727636a1d9f0c7766fbcb9f5b;p=thirdparty%2Flibvirt.git 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 --- 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}