]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
vsh: Add '--dump-help' option for 'self-test' command
authorPeter Krempa <pkrempa@redhat.com>
Fri, 1 Mar 2024 22:01:54 +0000 (23:01 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 13 Mar 2024 14:02:52 +0000 (15:02 +0100)
The new option dumps the full help outputs for every command so that
it's possible to conveniently check that subsequent refactors will not
impact any of the external functionality.

No man page entry is needed as the command is internal/undocumented.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tools/vsh.c

index 4f98f563f3bb7c5cdb150c3ed7976e70cb7b8062..37a00e206594985e8034579bd5e059785a2a088f 100644 (file)
@@ -3351,6 +3351,10 @@ const vshCmdOptDef opts_selftest[] = {
      .type = VSH_OT_BOOL,
      .help = N_("output the list of options which are missing completers")
     },
+    {.name = "dump-help",
+     .type = VSH_OT_BOOL,
+     .help = N_("output help for each command")
+    },
     {.name = NULL}
 };
 const vshCmdInfo info_selftest[] = {
@@ -3369,9 +3373,14 @@ cmdSelfTest(vshControl *ctl, const vshCmd *cmd)
     const vshCmdGrp *grp;
     const vshCmdDef *def;
     bool completers = vshCommandOptBool(cmd, "completers-missing");
+    bool dumphelp = vshCommandOptBool(cmd, "dump-help");
 
     for (grp = cmdGroups; grp->name; grp++) {
         for (def = grp->commands; def->name; def++) {
+
+            if (dumphelp && !def->alias)
+                vshCmddefHelp(def);
+
             if (vshCmddefCheckInternals(ctl, def, completers) < 0)
                 return false;
         }