Prettier-print the generated config schema
This commit is contained in:
parent
3cb5db7528
commit
2f70c6f7fa
1 changed files with 2 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
from json import dump
|
from json import dump
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from pprint import pp
|
from pprint import pp
|
||||||
|
from shutil import get_terminal_size
|
||||||
from typing import Any, Mapping
|
from typing import Any, Mapping
|
||||||
|
|
||||||
from apischema import schema, settings
|
from apischema import schema, settings
|
||||||
|
@ -35,7 +36,7 @@ def write() -> None:
|
||||||
|
|
||||||
schema_file = Path(__file__).parent / Config.schema.name
|
schema_file = Path(__file__).parent / Config.schema.name
|
||||||
print(f"Writing this schema to {schema_file}")
|
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:
|
with open(schema_file, "w") as fp:
|
||||||
dump(schema, fp, indent="\t", sort_keys=True)
|
dump(schema, fp, indent="\t", sort_keys=True)
|
||||||
fp.write("\n")
|
fp.write("\n")
|
||||||
|
|
Loading…
Reference in a new issue