[core] Re-enable preliminary module loading (stubbed)

Add logic for parsing commandline options, and a preliminary stub for
loading modules.

Note: The idea is that core.module.load() will return a valid, but
empty, module that displays an error, if the module cannot be loaded
This commit is contained in:
Tobias Witek 2020-01-19 15:36:52 +01:00
parent f234f81aa9
commit 8622673114
7 changed files with 68 additions and 6 deletions

15
core/config.py Normal file
View file

@ -0,0 +1,15 @@
import argparse
MODULE_HELP = "Specify a space-separated list of modules to load. The order of the list determines their order in the i3bar (from left to right). Use <module>:<alias> to provide an alias in case you want to load the same module multiple times, but specify different parameters."
class Config(object):
def __init__(self, args):
parser = argparse.ArgumentParser(description='bumblebee-status is a modular, theme-able status line generator for the i3 window manager. https://github.com/tobi-wan-kenobi/bumblebee-status/wiki')
parser.add_argument("-m", "--modules", nargs="+", action='append', default=[],
help=MODULE_HELP)
self._args = parser.parse_args(args)
def modules(self):
return [item for sub in self._args.modules for item in sub]
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4

9
core/module.py Normal file
View file

@ -0,0 +1,9 @@
def load(module_name):
pass
class Module(object):
def update(self):
pass
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4