summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2016-06-13 18:36:12 -0400
committerCole Robinson <crobinso@redhat.com>2016-06-13 19:15:19 -0400
commit7018904959ecd11286ce4eb5e7985b50a3df3608 (patch)
tree4da31cb8615a1ae4bb497bab3747035f43ae4920
parent7cd04a9f861854612c22ce8b57a5a157ace9ceb6 (diff)
downloadvirt-manager-7018904959ecd11286ce4eb5e7985b50a3df3608.tar.gz
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
-rw-r--r--virtinst/cli.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 99af5ded..c38d4587 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -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":
- 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 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
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)):
- ret = True
+
+ 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