Skip to content

Commit

Permalink
Merge pull request #764 from michalroxorpl/external_configuration_file
Browse files Browse the repository at this point in the history
Add parameter to specify a configuration file
  • Loading branch information
tobi-wan-kenobi authored Feb 20, 2021
2 parents 31f1f99 + 618ebbe commit d442503
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions bumblebee_status/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ 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(
"-c",
"--config-file",
action="store",
default=None,
help="Specify a configuration file to use"
)
parser.add_argument(
"-m", "--modules", nargs="+", action="append", default=[], help=MODULE_HELP
)
Expand Down Expand Up @@ -203,13 +210,18 @@ def __init__(self, args):

self.__args = parser.parse_args(args)

for cfg in [
"~/.bumblebee-status.conf",
"~/.config/bumblebee-status.conf",
"~/.config/bumblebee-status/config",
]:
if self.__args.config_file:
cfg = self.__args.config_file
cfg = os.path.expanduser(cfg)
self.load_config(cfg)
else:
for cfg in [
"~/.bumblebee-status.conf",
"~/.config/bumblebee-status.conf",
"~/.config/bumblebee-status/config",
]:
cfg = os.path.expanduser(cfg)
self.load_config(cfg)

parameters = [item for sub in self.__args.parameters for item in sub]
for param in parameters:
Expand Down

0 comments on commit d442503

Please sign in to comment.