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 <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Peter Krempa 2021-09-16 16:07:19 +02:00
parent f20512c414
commit 80f70c74a7

View File

@ -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}