1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

vsh: Fix broken assumption that required VSH_OT_INT must be positional

In at least one case we've wanted a mandatory argument which requires
the explicit flag. Fix the assumption before converting everything over
to the new flags.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2024-03-05 16:00:41 +01:00
parent ac150162fd
commit c53c064ef2
2 changed files with 7 additions and 3 deletions

View File

@ -1011,7 +1011,6 @@ static const vshCmdInfo info_daemon_log_outputs = {
static const vshCmdOptDef opts_daemon_timeout[] = {
{.name = "timeout",
.type = VSH_OT_INT,
.positional = true,
.required = true,
.help = N_("number of seconds the daemon will run without any active connection"),
.flags = VSH_OFLAG_REQ | VSH_OFLAG_REQ_OPT

View File

@ -426,9 +426,14 @@ vshCmddefCheckInternals(vshControl *ctl,
opt->name, cmd->name);
return -1;
}
isRequired = true;
/* allow INT arguments which are required and non-positional */
if (!(opt->flags & VSH_OFLAG_REQ_OPT)) {
seenPositionalOption = true;
isPositional = true;
isRequired = true;
}
} else {
isPositional = false;
isRequired = false;