mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
vsh: Require that positional non-argv arguments are required
This is logically enforced by existing checks, thus we can formalize it. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
c53c064ef2
commit
a455220166
@ -329,6 +329,13 @@ vshCmddefCheckInternals(vshControl *ctl,
|
||||
}
|
||||
}
|
||||
|
||||
/* require that positional non-argv options are required */
|
||||
if (opt->positional && !opt->required && opt->type != VSH_OT_ARGV) {
|
||||
vshError(ctl, "positional argument '%s' of command '%s' must be required",
|
||||
opt->name, cmd->name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (opt->type) {
|
||||
case VSH_OT_NONE:
|
||||
vshError(ctl, "invalid type 'NONE' of option '%s' of command '%s'",
|
||||
|
Loading…
Reference in New Issue
Block a user