From 2f70c6f7fa1ff16a8a79f6f977785ba37c296870 Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Sat, 22 Jun 2024 20:12:50 +1000 Subject: [PATCH] Prettier-print the generated config schema --- src/mpd_now_playable/config/schema.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mpd_now_playable/config/schema.py b/src/mpd_now_playable/config/schema.py index 307271b..93c0c10 100644 --- a/src/mpd_now_playable/config/schema.py +++ b/src/mpd_now_playable/config/schema.py @@ -1,6 +1,7 @@ from json import dump from pathlib import Path from pprint import pp +from shutil import get_terminal_size from typing import Any, Mapping from apischema import schema, settings @@ -35,7 +36,7 @@ def write() -> None: schema_file = Path(__file__).parent / Config.schema.name print(f"Writing this schema to {schema_file}") - pp(schema) + pp(schema, sort_dicts=True, width=get_terminal_size().columns) with open(schema_file, "w") as fp: dump(schema, fp, indent="\t", sort_keys=True) fp.write("\n")