mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-20 04:58:32 +02:00
Simplify config override syntax (#8)
* update tests and expected behavior * clean up arg parsing tests * update deserialization * update deserialization * config argparse action * update override application logic * update tests; delete unused imports * override param must be list * update docstring * update test input to SUT * update remaining override unittests * make format * forgot to update CLI syntax
This commit is contained in:
parent
d55fa4134a
commit
2be0d3729e
2 changed files with 4 additions and 0 deletions
|
@ -18,6 +18,7 @@ from .plugins import util
|
|||
|
||||
|
||||
def deserialize_config_args(input: list) -> dict:
|
||||
|
||||
"""
|
||||
|
||||
Convert a two-element list of configuration key-value pair into a flat dict
|
||||
|
@ -44,6 +45,7 @@ def deserialize_config_args(input: list) -> dict:
|
|||
cfg_value = False
|
||||
|
||||
runtime_modifications[cfg_key] = cfg_value
|
||||
|
||||
return runtime_modifications
|
||||
|
||||
|
||||
|
|
|
@ -11,9 +11,11 @@ def apply_overrides(overrides: list, base_config: dict) -> dict:
|
|||
"""
|
||||
config = base_config.copy()
|
||||
for pairs in overrides:
|
||||
|
||||
key_as_dots, override_value = list(pairs.items())[0]
|
||||
keys = key_as_dots.split(".")
|
||||
config = _recursively_apply(config, keys, override_value)
|
||||
|
||||
return config
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue