~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/fractal-garden

ASCII fractals rendered in CI: each preset is a view, every check draws them all

0
0
main
31 lines · 735 B Raw History
"""Draw every preset, or the ones named, and fail if one comes out flat."""

import json
import pathlib
import sys

from fractal import render


def presets():
    for path in sorted(pathlib.Path("presets").glob("*.json")):
        yield path.stem, json.loads(path.read_text())


def main(names):
    flat = []
    for name, preset in presets():
        if names and name not in names:
            continue
        rows = render(preset)
        print(f"== {name}: {preset.get('title', '')}")
        print("\n".join(rows))
        print()
        if len(set("".join(rows))) < 3:
            flat.append(name)
    if flat:
        sys.exit(f"flat, nothing to see: {', '.join(flat)}")


if __name__ == "__main__":
    main(sys.argv[1:])