jp (outputs): moved output options parsing and checking to base methods
This commit is contained in:
parent
48a5f1f4c7
commit
a860999204
1 changed files with 20 additions and 16 deletions
|
|
@ -318,6 +318,24 @@ class Jp(object):
|
|||
'description': description
|
||||
}
|
||||
|
||||
def parse_output_options(self):
|
||||
options = self.command.args.output_opts
|
||||
options_dict = {}
|
||||
for option in options:
|
||||
try:
|
||||
key, value = option.split(u'=', 1)
|
||||
except ValueError:
|
||||
key, value = option, None
|
||||
options_dict[key.strip()] = value.strip() if value is not None else None
|
||||
return options_dict
|
||||
|
||||
def check_output_options(self, accepted_set, options):
|
||||
if not accepted_set.issuperset(options):
|
||||
self.disp(u"The following output options are invalid: {invalid_options}".format(
|
||||
invalid_options = u', '.join(set(options).difference(accepted_set))),
|
||||
error=True)
|
||||
self.quit(C.EXIT_BAD_ARG)
|
||||
|
||||
def import_plugins(self):
|
||||
"""Automaticaly import commands and outputs in jp
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue