weboob-config can't be run in interactive mode anymore
This commit is contained in:
parent
9f3b493a71
commit
c587ce65b0
2 changed files with 14 additions and 4 deletions
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue