]> xenbits.xensource.com Git - libvirt.git/commitdiff
vsh: Extract vshCmddefCheckInternals from vshCmddefOptParse
authorErik Skultety <eskultet@redhat.com>
Fri, 16 Sep 2016 07:58:24 +0000 (09:58 +0200)
committerErik Skultety <eskultet@redhat.com>
Tue, 20 Sep 2016 13:05:32 +0000 (15:05 +0200)
Originally introduced by commit 2432521e which correctly split
vshCmddefOptParse into command's options validation and options parsing.
However, command's 'internals' are not tied solely to .options, rather it
should be about the overall structure, therefore the validation should be
extracted from vshCmddefOptParse and performed only within our test suite, i.e.
in vshSelfTest.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
tools/vsh.c

index 1d87dfabb983b11cd9aee8ddfedc561e96a022eb..1cf929424b3fe422d623de58492a0fa825ce7947 100644 (file)
@@ -428,9 +428,6 @@ static int
 vshCmddefOptParse(const vshCmdDef *cmd, uint64_t *opts_need_arg,
                   uint64_t *opts_required)
 {
-    if (vshCmddefCheckInternals(cmd) < 0)
-        return -1;
-
     if (vshCmddefOptFill(cmd, opts_need_arg, opts_required) < 0)
         return -1;
 
@@ -3362,7 +3359,7 @@ cmdSelfTest(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
             if (def->flags & VSH_CMD_FLAG_ALIAS)
                 continue;
 
-            if (!vshCmddefHelp(ctl, def->name))
+            if (vshCmddefCheckInternals(def) < 0)
                 return false;
         }
     }