mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-06 18:05:45 +00:00
virsh: cmdEcho: Make '--xml' and '--shell' mutually exclusive
Initialize the flags earlier and use VSH_EXCLUSIVE_OPTIONS_VAR to declare the conflicting options as exclusive. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
c67fc3ea82
commit
86de16b317
13
tools/vsh.c
13
tools/vsh.c
@ -3150,20 +3150,15 @@ const vshCmdInfo info_echo[] = {
|
|||||||
bool
|
bool
|
||||||
cmdEcho(vshControl *ctl, const vshCmd *cmd)
|
cmdEcho(vshControl *ctl, const vshCmd *cmd)
|
||||||
{
|
{
|
||||||
bool shell = false;
|
bool shell = vshCommandOptBool(cmd, "shell");
|
||||||
bool xml = false;
|
bool xml = vshCommandOptBool(cmd, "xml");
|
||||||
bool err = false;
|
bool err = vshCommandOptBool(cmd, "err");
|
||||||
int count = 0;
|
int count = 0;
|
||||||
const vshCmdOpt *opt = NULL;
|
const vshCmdOpt *opt = NULL;
|
||||||
g_autofree char *arg = NULL;
|
g_autofree char *arg = NULL;
|
||||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
if (vshCommandOptBool(cmd, "shell"))
|
VSH_EXCLUSIVE_OPTIONS_VAR(shell, xml);
|
||||||
shell = true;
|
|
||||||
if (vshCommandOptBool(cmd, "xml"))
|
|
||||||
xml = true;
|
|
||||||
if (vshCommandOptBool(cmd, "err"))
|
|
||||||
err = true;
|
|
||||||
|
|
||||||
while ((opt = vshCommandOptArgv(ctl, cmd, opt))) {
|
while ((opt = vshCommandOptArgv(ctl, cmd, opt))) {
|
||||||
g_autofree char *str = NULL;
|
g_autofree char *str = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user