]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
vsh: Add completer for '--command' of 'help' command
authorPeter Krempa <pkrempa@redhat.com>
Thu, 16 Sep 2021 14:07:19 +0000 (16:07 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 17 Sep 2021 07:40:46 +0000 (09:40 +0200)
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>
tools/vsh.c

index 9c6783dad10f43178329128a7d255735111ecc77..cf24586b25b560339619913721b31cf0d28588f0 100644 (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}