From 03816396902beea8438c95d9cea1111e6c613c9d Mon Sep 17 00:00:00 2001 From: Micah Jerome Ellison Date: Sat, 26 Feb 2022 14:06:37 -0800 Subject: [PATCH] Prevent ruamel from collapsing config YAML --- jrnl/config.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/jrnl/config.py b/jrnl/config.py index b061be5f..fcdc72bb 100644 --- a/jrnl/config.py +++ b/jrnl/config.py @@ -51,12 +51,16 @@ def make_yaml_valid_dict(input: list) -> dict: def save_config(config, alt_config_path=None): """Supply alt_config_path if using an alternate config through --config-file.""" config["version"] = __version__ + + yaml = YAML(typ="safe") + yaml.default_flow_style = False # prevents collapsing of tree structure + with open( alt_config_path if alt_config_path else get_config_path(), "w", encoding=YAML_FILE_ENCODING, ) as f: - YAML(typ="safe").dump(config, f) + yaml.dump(config, f) def get_config_path():