lib: add cli option for lib.config

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-11-19 23:52:10 +01:00
parent 146818793e
commit 431ba6b4ef

View file

@ -5,6 +5,7 @@ from contextlib import contextmanager
from glob import glob from glob import glob
from json import dumps, loads from json import dumps, loads
from json.decoder import JSONDecodeError from json.decoder import JSONDecodeError
from sys import argv, stderr
from time import time from time import time
from typing import Any from typing import Any
from urllib.parse import urlparse from urllib.parse import urlparse
@ -60,7 +61,7 @@ class ConfigLoader:
"timestamp": time(), "timestamp": time(),
} }
output.update(kwargs) output.update(kwargs)
print(dumps(output)) print(dumps(output), file=stderr)
def update(self, root: dict[str, Any], updatee: dict[str, Any]) -> dict[str, Any]: def update(self, root: dict[str, Any], updatee: dict[str, Any]) -> dict[str, Any]:
"""Recursively update dictionary""" """Recursively update dictionary"""
@ -180,3 +181,6 @@ class ConfigLoader:
CONFIG = ConfigLoader() CONFIG = ConfigLoader()
if __name__ == "__main__":
print(CONFIG.y(argv[1]))