From 139760e841ad4875b59fe11e052af1bb56dc06ea Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Tue, 26 Feb 2019 10:32:32 +0100 Subject: [PATCH] weboob-config: add commands 'enable' and 'disable' --- weboob/applications/weboobcfg/weboobcfg.py | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/weboob/applications/weboobcfg/weboobcfg.py b/weboob/applications/weboobcfg/weboobcfg.py index 95b418fc4f..3cc747eac1 100644 --- a/weboob/applications/weboobcfg/weboobcfg.py +++ b/weboob/applications/weboobcfg/weboobcfg.py @@ -176,6 +176,30 @@ def do_list(self, line): ]) self.format(row) + def do_enable(self, backend_name): + """ + enable NAME + + Enable a backend. + """ + try: + self.weboob.backends_config.edit_backend(backend_name, {'_enabled': '1'}) + except KeyError: + print('Backend instance "%s" does not exist' % backend_name, file=self.stderr) + return 1 + + def do_disable(self, backend_name): + """ + disable NAME + + Disable a backend. + """ + try: + self.weboob.backends_config.edit_backend(backend_name, {'_enabled': '0'}) + except KeyError: + print('Backend instance "%s" does not exist' % backend_name, file=self.stderr) + return 1 + def do_remove(self, backend_name): """ remove NAME -- GitLab