properly implement -c,--config option

This commit is contained in:
Mike Fährmann
2015-11-14 17:22:56 +01:00
parent b683427d42
commit b55870909c
2 changed files with 10 additions and 5 deletions

View File

@@ -16,7 +16,7 @@ import platform
# --------------------------------------------------------------------
# public interface
def load(*files):
def load(*files, strict=False):
"""Load JSON configuration files"""
configfiles = files or _default_configs
for conf in configfiles:
@@ -26,6 +26,8 @@ def load(*files):
confdict = json.load(file)
_config.update(confdict)
except FileNotFoundError:
if strict:
raise
continue
except json.decoder.JSONDecodeError as exception:
print("Error while loading '", path, "':", sep="", file=sys.stderr)