Merge pull request #764 from michalroxorpl/external_configuration_file

Add parameter to specify a configuration file
This commit is contained in:
tobi-wan-kenobi 2021-02-20 14:49:45 +01:00 committed by GitHub
commit d4425039b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -147,6 +147,13 @@ class Config(util.store.Store):
parser = argparse.ArgumentParser( 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" 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(
"-c",
"--config-file",
action="store",
default=None,
help="Specify a configuration file to use"
)
parser.add_argument( parser.add_argument(
"-m", "--modules", nargs="+", action="append", default=[], help=MODULE_HELP "-m", "--modules", nargs="+", action="append", default=[], help=MODULE_HELP
) )
@ -203,6 +210,11 @@ class Config(util.store.Store):
self.__args = parser.parse_args(args) self.__args = parser.parse_args(args)
if self.__args.config_file:
cfg = self.__args.config_file
cfg = os.path.expanduser(cfg)
self.load_config(cfg)
else:
for cfg in [ for cfg in [
"~/.bumblebee-status.conf", "~/.bumblebee-status.conf",
"~/.config/bumblebee-status.conf", "~/.config/bumblebee-status.conf",