diff options
-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) |