diff --git a/weboob/applications/weboobcfg/weboobcfg.py b/weboob/applications/weboobcfg/weboobcfg.py index 7994c44a..1869c9d9 100644 --- a/weboob/applications/weboobcfg/weboobcfg.py +++ b/weboob/applications/weboobcfg/weboobcfg.py @@ -21,6 +21,7 @@ import os import sys import re +from copy import copy from weboob.capabilities.account import ICapAccount from weboob.core.modules import ModuleLoadError @@ -40,6 +41,10 @@ class WeboobCfg(ReplApplication): COMMANDS_FORMATTERS = {'backends': 'table', 'list': 'table', } + DISABLE_REPL = True + + weboob_commands = copy(ReplApplication.weboob_commands) + weboob_commands.remove('backends') def load_default_backends(self): pass @@ -110,12 +115,15 @@ class WeboobCfg(ReplApplication): def do_list(self, line): """ - list + list [CAPS ..] Show configured backends. """ + caps = line.split() for instance_name, name, params in sorted(self.weboob.backends_config.iter_backends()): backend = self.weboob.modules_loader.get_or_load_module(name) + if caps and not self.caps_included(backend.iter_caps(), caps): + continue row = OrderedDict([('Instance name', instance_name), ('Backend', name), ('Configuration', ', '.join( diff --git a/weboob/tools/application/repl.py b/weboob/tools/application/repl.py index f52367c4..6d62575d 100644 --- a/weboob/tools/application/repl.py +++ b/weboob/tools/application/repl.py @@ -57,6 +57,8 @@ class ReplOptionFormatter(IndentedHelpFormatter): def format_commands(self, commands): s = u'' for section, cmds in commands.iteritems(): + if len(cmds) == 0: + continue if len(s) > 0: s += '\n' s += '%s Commands:\n' % section @@ -78,6 +80,9 @@ class ReplApplication(Cmd, ConsoleApplication): DEFAULT_FORMATTER = 'multiline' COMMANDS_FORMATTERS = {} + weboob_commands = set(['backends', 'condition', 'count', 'formatter', 'inspect', 'logging', 'select', 'quit']) + hidden_commands = set(['EOF']) + def __init__(self): Cmd.__init__(self) # XXX can't use bold prompt because: @@ -98,9 +103,6 @@ class ReplApplication(Cmd, ConsoleApplication): 'Type "help" to display available commands.', '', )) - self.weboob_commands = ['backends', 'condition', 'count', 'formatter', 'inspect', 'logging', 'select', 'quit'] - self.hidden_commands = set(['EOF']) - self.formatters_loader = FormattersLoader() for key, klass in self.EXTRA_FORMATTERS.iteritems(): self.formatters_loader.register_formatter(key, klass)