add list-modules option in the command line interface
ex: radioob> backends list-modules Signed-off-by: capitaldata <capitaldata@capitaldata-desktop2.(none)> Signed-off-by: Romain Bignon <romain@symlink.me>
This commit is contained in:
parent
6f20707bed
commit
5e8ac671da
1 changed files with 28 additions and 9 deletions
|
|
@ -506,7 +506,7 @@ class ReplApplication(Cmd, ConsoleApplication):
|
||||||
|
|
||||||
def complete_backends(self, text, line, begidx, endidx):
|
def complete_backends(self, text, line, begidx, endidx):
|
||||||
choices = []
|
choices = []
|
||||||
commands = ['enable', 'disable', 'only', 'list', 'add', 'register', 'edit', 'remove']
|
commands = ['enable', 'disable', 'only', 'list', 'add', 'register', 'edit', 'remove', 'list-modules']
|
||||||
available_backends_names = set(backend.name for backend in self.weboob.iter_backends())
|
available_backends_names = set(backend.name for backend in self.weboob.iter_backends())
|
||||||
enabled_backends_names = set(backend.name for backend in self.enabled_backends)
|
enabled_backends_names = set(backend.name for backend in self.enabled_backends)
|
||||||
|
|
||||||
|
|
@ -537,14 +537,15 @@ class ReplApplication(Cmd, ConsoleApplication):
|
||||||
Select used backends.
|
Select used backends.
|
||||||
|
|
||||||
ACTION is one of the following (default: list):
|
ACTION is one of the following (default: list):
|
||||||
* enable enable given backends
|
* enable enable given backends
|
||||||
* disable disable given backends
|
* disable disable given backends
|
||||||
* only enable given backends and disable the others
|
* only enable given backends and disable the others
|
||||||
* list display enabled and available backends
|
* list list backends
|
||||||
* add add a backend
|
* add add a backend
|
||||||
* register register a new account on a website
|
* register register a new account on a website
|
||||||
* edit edit a backend
|
* edit edit a backend
|
||||||
* remove remove a backend
|
* remove remove a backend
|
||||||
|
* list-modules list modules
|
||||||
"""
|
"""
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
if line:
|
if line:
|
||||||
|
|
@ -618,6 +619,24 @@ class ReplApplication(Cmd, ConsoleApplication):
|
||||||
for backend in given_backends:
|
for backend in given_backends:
|
||||||
self.weboob.backends_config.remove_backend(backend.name)
|
self.weboob.backends_config.remove_backend(backend.name)
|
||||||
self.unload_backends(backend.name)
|
self.unload_backends(backend.name)
|
||||||
|
elif action == 'list-modules':
|
||||||
|
modules = []
|
||||||
|
print 'Modules list:'
|
||||||
|
for name, info in sorted(self.weboob.repositories.get_all_modules_info().iteritems()):
|
||||||
|
if not self.is_module_loadable(info):
|
||||||
|
continue
|
||||||
|
modules.append(name)
|
||||||
|
loaded = ' '
|
||||||
|
for bi in self.weboob.iter_backends():
|
||||||
|
if bi.NAME == name:
|
||||||
|
if loaded == ' ':
|
||||||
|
loaded = 'X'
|
||||||
|
elif loaded == 'X':
|
||||||
|
loaded = 2
|
||||||
|
else:
|
||||||
|
loaded += 1
|
||||||
|
print '[%s] %s%-15s%s %s' % (loaded, self.BOLD, name, self.NC, info.description)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print >>sys.stderr, 'Unknown action: "%s"' % action
|
print >>sys.stderr, 'Unknown action: "%s"' % action
|
||||||
return 1
|
return 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue