diff --git a/virt-install b/virt-install index 5b760e949..9f6cfe1e8 100755 --- a/virt-install +++ b/virt-install @@ -110,10 +110,6 @@ def convert_old_printxml(options): options.xmlonly = options.xmlstep del(options.xmlstep) - # The case when someone specifies a bare --print-xml - if options.xmlonly is True: - options.xmlonly = "all" - def convert_old_sound(options): if not options.sound: diff --git a/virtinst/cli.py b/virtinst/cli.py index 088bdf548..694ce7b9c 100644 --- a/virtinst/cli.py +++ b/virtinst/cli.py @@ -483,10 +483,20 @@ def add_misc_options(grp, prompt=False, replace=False, "with the same name.")) if printxml: - grp.add_argument("--print-xml", nargs="?", dest="xmlonly", - default=False, const=True, - help=_("Print the generated domain XML rather than create " - "the guest.")) + print_kwargs = { + "dest": "xmlonly", + "default": False, + "help": _("Print the generated domain XML rather than create " + "the guest."), + } + + if printstep: + print_kwargs["nargs"] = "?" + print_kwargs["const"] = "all" + else: + print_kwargs["action"] = "store_true" + + grp.add_argument("--print-xml", **print_kwargs) if printstep: # Back compat, argparse allows us to use --print-xml # for everything.