cli: Allow '--option help' for introspection as well

This commit is contained in:
Cole Robinson
2014-01-27 14:48:23 -05:00
parent e2cb91c39d
commit b963c3ec39
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -525,7 +525,7 @@ c.add_invalid("--nodisks --boot network --paravirt --arch mips") # Invalid arch
c = vinst.add_category("misc", "--nographics --noautoconsole")
c.add_valid("--panic=? --disk=?") # Make sure introspection doesn't blow up
c.add_valid("--panic help --disk=?") # Make sure introspection doesn't blow up
c.add_compare("", "noargs-fail") # No arguments
c.add_compare("--hvm --nodisks --pxe --print-step all", "simple-pxe") # Diskless PXE install
c.add_compare("--hvm --cdrom %(EXISTIMG2)s --file %(EXISTIMG1)s --os-variant win2k3 --wait 0 --vcpus cores=4 --controller usb,model=none", "w2k3-cdrom") # HVM windows install with disk
+4 -4
View File
@@ -98,8 +98,8 @@ class VirtHelpFormatter(argparse.RawDescriptionHelpFormatter):
def setupParser(usage, description, introspection_epilog=False):
epilog = _("See man page for examples and full option syntax.")
if introspection_epilog:
epilog = _("Use --option=? to see available suboptions, example: "
"--network=?") + "\n" + epilog
epilog = _("Use '--option=?' or '--option help' to see "
"available suboptions") + "\n" + epilog
parser = argparse.ArgumentParser(
usage=usage, description=description,
@@ -860,7 +860,7 @@ def add_net_option(devg):
"--network network=my_libvirt_virtual_net\n"
"--network network=mynet,model=virtio,mac=00:11...\n"
"--network network=mynet,filterref=clean-traffic\n"
"--network=?"))
"--network help"))
def add_device_options(devg):
@@ -1227,7 +1227,7 @@ class VirtCLIParser(object):
def check_introspection(self, option):
for optstr in util.listify(option):
if optstr == "?":
if optstr == "?" or optstr == "help":
print "--%s options:" % self.cli_arg_name
for arg in sorted(self._params, key=lambda p: p.cliname):
print " %s" % arg.cliname