[core] Pass configuration parameters to modules

User can now use -p <key>=<value> to pass configuration parameters to
modules. For this, the module gets a "parameter()" method. Parameter
keys are in the format <name>.<key> where <name> is the name of the
loaded module. This is either the name of the module itself (e.g. "cpu")
or its alias, if the user specified it, for example:

bumblebee-status -m cpu -p cpu.warning=90

vs.

bumblebee-status -m cpu:test -p test.warning=90

see #23
This commit is contained in:
Tobi-wan Kenobi 2016-12-09 07:57:21 +01:00
parent c8a51b416f
commit f33711f49f
4 changed files with 52 additions and 5 deletions

View file

@ -11,7 +11,7 @@ from tests.util import MockOutput
class TestEngine(unittest.TestCase):
def setUp(self):
self.engine = Engine(config=Config(), output=MockOutput())
self.singleWidgetModule = [{"module": "test"}]
self.singleWidgetModule = [{"module": "test", "name": "a"}]
self.testModule = "test"
self.invalidModule = "no-such-module"
self.testModuleSpec = "bumblebee.modules.{}".format(self.testModule)