From 3f5f2b2479625103b2e2e389e7f0856b330abb7d Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Fri, 7 Nov 2014 17:08:16 +0100 Subject: [PATCH] weboob-config info: put all config details in dicts --- weboob/applications/weboobcfg/weboobcfg.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/weboob/applications/weboobcfg/weboobcfg.py b/weboob/applications/weboobcfg/weboobcfg.py index 1419f83d..971abff2 100644 --- a/weboob/applications/weboobcfg/weboobcfg.py +++ b/weboob/applications/weboobcfg/weboobcfg.py @@ -45,13 +45,17 @@ class ModuleInfoFormatter(IFormatter): result += '| Location | %s\n' % minfo['location'] if 'config' in minfo: first = True - for key, value in minfo['config'].iteritems(): + for key, field in minfo['config'].iteritems(): + label = field['label'] + if field['default'] is not None: + label += ' (default: %s)' % field['default'] + if first: result += '| | \n' - result += '| Configuration | %s: %s\n' % (key, value) + result += '| Configuration | %s: %s\n' % (key, label) first = False else: - result += '| | %s: %s\n' % (key, value) + result += '| | %s: %s\n' % (key, label) result += "'-----------------'\n" return result @@ -259,11 +263,13 @@ class WeboobCfg(ReplApplication): if module: module_info['config'] = {} for key, field in module.config.iteritems(): - value = field.label - if field.default is not None: - value += ' (default: %s)' % field.default - - module_info['config'][key] = value + module_info['config'][key] = {'label': field.label, + 'default': field.default, + 'description': field.description, + 'regexp': field.regexp, + 'choices': field.choices, + 'masked': field.masked, + 'required': field.required} return module_info def do_applications(self, line):