diff options
author | MaZderMind <github@mazdermind.de> | 2015-05-10 21:14:09 +0200 |
---|---|---|
committer | MaZderMind <github@mazdermind.de> | 2015-05-10 21:14:09 +0200 |
commit | 80d57d8006a5af2854efa195c49c6f5edd5f93b1 (patch) | |
tree | f946b6ce3f9305a7e8d8761e2630b07d32273ef1 | |
parent | ff90df796c715ee9c95fb8a2152cea2698fe92ab (diff) |
Allow Parsing an extra File via Command-Line
-rw-r--r-- | voctocore/lib/args.py | 3 | ||||
-rw-r--r-- | voctocore/lib/config.py | 14 |
2 files changed, 12 insertions, 5 deletions
diff --git a/voctocore/lib/args.py b/voctocore/lib/args.py index 6699679..3f1f3df 100644 --- a/voctocore/lib/args.py +++ b/voctocore/lib/args.py @@ -9,7 +9,8 @@ parser.add_argument('-v', '--verbose', action='store_true', parser.add_argument('-c', '--color', action='store', choices=['auto', 'always', 'never'], default='auto', help="Control the use of colors in the Log-Output") -parser.add_argument('-i', '---config-ini', action='store', +parser.add_argument('-i', '--ini-file', action='store', help="Load a custom config.ini-File") + Args = parser.parse_args() diff --git a/voctocore/lib/config.py b/voctocore/lib/config.py index 88e713c..fdd2360 100644 --- a/voctocore/lib/config.py +++ b/voctocore/lib/config.py @@ -1,5 +1,6 @@ import os.path from configparser import SafeConfigParser +from lib.args import Args __all__ = ['Config'] @@ -8,9 +9,14 @@ def getlist(self, section, option): SafeConfigParser.getlist = getlist -Config = SafeConfigParser() -Config.read([ +files = [ 'default-config.ini', '/etc/voctomix.ini', - os.path.expanduser('~/.voctomix.ini') -]) + os.path.expanduser('~/.voctomix.ini'), +] + +if Args.ini_file is not None: + files.append(Args.ini_file) + +Config = SafeConfigParser() +Config.read(files) |