cli: Maintain same --print-xml behavior for non virt-install

Don't want it scooping up any nargs
This commit is contained in:
Cole Robinson 2015-04-07 19:58:28 -04:00
parent a5d03fdf6e
commit 9b21f27e31
2 changed files with 14 additions and 8 deletions

View File

@ -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:

View File

@ -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.