cli: Tweak introspection sorting a bit

- Put clearxml at the very top, because it's a bit special and I
  don't like it mixed in with the interesting settings
- Put address.X at the top, after clearxml, because there's a lot of
  settings and I'd like to keep them away from the users' visual field
This commit is contained in:
Cole Robinson 2019-05-10 18:21:40 -04:00
parent a274cc97cd
commit 5f4b781580

View File

@ -1207,8 +1207,16 @@ class VirtCLIParser(metaclass=_InitClass):
"""
Print out all _param names, triggered via ex. --disk help
"""
def _sortkey(virtarg):
prefix = ""
if virtarg.cliname == "clearxml":
prefix = "0"
if virtarg.cliname.startswith("address."):
prefix = "1"
return prefix + virtarg.cliname
print("%s options:" % cls.cli_flag_name())
for arg in sorted(cls._virtargs, key=lambda p: p.cliname):
for arg in sorted(cls._virtargs, key=_sortkey):
print(" %s" % arg.cliname)
print("")