(cfg: dict)
| 150 | |
| 151 | |
| 152 | def write_config(cfg: dict) -> None: |
| 153 | if CONFIG_PATH.exists(): |
| 154 | backup = CONFIG_PATH.with_suffix(".json.bak") |
| 155 | shutil.copy2(CONFIG_PATH, backup) |
| 156 | print(yellow(f" existing config.json backed up to {backup.name}")) |
| 157 | with CONFIG_PATH.open("w", encoding="utf-8") as f: |
| 158 | json.dump(cfg, f, indent=2) |
| 159 | f.write("\n") |
| 160 | |
| 161 | |
| 162 | def main() -> int: |