aboutsummaryrefslogtreecommitdiff
path: root/voctocore
diff options
context:
space:
mode:
authorMaZderMind <github@mazdermind.de>2015-05-10 21:14:09 +0200
committerMaZderMind <github@mazdermind.de>2015-05-10 21:14:09 +0200
commit80d57d8006a5af2854efa195c49c6f5edd5f93b1 (patch)
treef946b6ce3f9305a7e8d8761e2630b07d32273ef1 /voctocore
parentff90df796c715ee9c95fb8a2152cea2698fe92ab (diff)
Allow Parsing an extra File via Command-Line
Diffstat (limited to 'voctocore')
-rw-r--r--voctocore/lib/args.py3
-rw-r--r--voctocore/lib/config.py14
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)