mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-23 17:34:21 +03:00
cli: Move introspection checking out of Parser class
We can do that at the cli entry point, and only have the parser print its subargs
This commit is contained in:
parent
7cd04a9f86
commit
7018904959
@ -1106,15 +1106,14 @@ class VirtCLIParser(object):
|
||||
# end of the domain XML, which gives an ugly diff
|
||||
clear_inst.clear(leave_stub=bool(cbdata.opts.optsdict))
|
||||
|
||||
def check_introspection(self, option):
|
||||
for optstr in util.listify(option):
|
||||
if optstr == "?" or optstr == "help":
|
||||
def print_introspection(self):
|
||||
"""
|
||||
Print out all _param names, triggered via ex. --disk help
|
||||
"""
|
||||
print "--%s options:" % self.cli_arg_name
|
||||
for arg in sorted(self._params, key=lambda p: p.cliname):
|
||||
print " %s" % arg.cliname
|
||||
print
|
||||
return True
|
||||
return False
|
||||
|
||||
def parse(self, guest, optlist, inst, validate=True):
|
||||
optlist = util.listify(optlist)
|
||||
@ -2504,8 +2503,10 @@ def check_option_introspection(options, parsermap):
|
||||
for option_variable_name in dir(options):
|
||||
if option_variable_name not in parsermap:
|
||||
continue
|
||||
if parsermap[option_variable_name].check_introspection(
|
||||
getattr(options, option_variable_name)):
|
||||
|
||||
for optstr in util.listify(getattr(options, option_variable_name)):
|
||||
if optstr == "?" or optstr == "help":
|
||||
parsermap[option_variable_name].print_introspection()
|
||||
ret = True
|
||||
|
||||
return ret
|
||||
|
Loading…
Reference in New Issue
Block a user