cli; Share --os-variant option registering

And improve the help message for both users
This commit is contained in:
Cole Robinson 2019-01-08 12:44:53 -05:00
parent 2a88d3a1af
commit 6c28f53590
3 changed files with 18 additions and 8 deletions

View File

@ -791,11 +791,8 @@ def parse_args():
cli.add_boot_options(insg)
insg.add_argument("--init", help=argparse.SUPPRESS)
osg = parser.add_argument_group(_("Guest OS Options"))
osg = cli.add_os_variant_option(parser, virtinstall=True)
osg.add_argument("--os-type", dest="distro_type", help=argparse.SUPPRESS)
osg.add_argument("--os-variant", dest="distro_variant",
help=_("The OS variant being installed in the guest, "
"e.g. 'fedora29', 'rhel7', 'win10 etc."))
devg = parser.add_argument_group(_("Device Options"))
cli.add_disk_option(devg)

View File

@ -373,10 +373,7 @@ def parse_args():
outg.add_argument("--confirm", action="store_true",
help=_("Require confirmation before saving any results."))
osg = parser.add_argument_group(_("OS options"))
osg.add_argument("--os-variant", dest="distro_variant",
help=_("The OS variant installed in the guest, "
"e.g. 'fedora29', 'rhel7', 'win10 etc."))
cli.add_os_variant_option(parser, virtinstall=False)
g = parser.add_argument_group(_("XML options"))
cli.add_disk_option(g, editexample=True)

View File

@ -845,6 +845,22 @@ def add_disk_option(stog, editexample=False):
"--disk=?") + editmsg)
def add_os_variant_option(parser, virtinstall):
osg = parser.add_argument_group(_("OS options"))
if virtinstall:
msg = _("The OS being installed in the guest.")
else:
msg = _("The OS installed in the guest.")
msg += "\n"
msg += _("This is used for deciding optimal defaults like virtio.\n"
"Example values: fedora29, rhel7.0, win10, ...\n"
"See 'osinfo-query os' for a full list.")
osg.add_argument("--os-variant", dest="distro_variant", help=msg)
return osg
#############################################
# CLI complex parsing helpers #
# (for options like --disk, --network, etc. #