From d9730033bb11305ebe76973ad63d098f25fc145a Mon Sep 17 00:00:00 2001 From: Florent Date: Tue, 2 Sep 2014 15:36:59 +0200 Subject: [PATCH] Allows shortcuts for modules. Related to #881 --- weboob/tools/application/console.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/weboob/tools/application/console.py b/weboob/tools/application/console.py index 37965eda..c62edc86 100644 --- a/weboob/tools/application/console.py +++ b/weboob/tools/application/console.py @@ -221,6 +221,18 @@ class ConsoleApplication(BaseApplication): else: raise BackendNotGiven(_id, backends) if backend_name is not None and not backend_name in dict(backends): + # Is the backend a short version of a real one? + found = False + for key in dict(backends): + if backend_name in key: + # two choices, ambiguous command + if found: + raise BackendNotFound(backend_name) + else: + found = True + _back = key + if found: + return _id, _back raise BackendNotFound(backend_name) return _id, backend_name