# pylint: skip-file
# mypy: ignore-errors

import sys
from os.path import dirname, join

from livereload import Server, shell

if __name__ == "__main__":
    cmd = "make html"
    if "win32" in sys.platform.lower():
        cmd = "make.bat html"

    server = Server()
    project_dir = join(dirname(__file__), "..")
    watch_dirs = [
        join(project_dir, "pytest_csv_params", "**/*"),
        join(project_dir, "_ptcsvp", "**/*"),
        join(project_dir, "tests", "**/*"),
        join(project_dir, "docs", "**/*"),
    ]
    for watch_dir in watch_dirs:
        server.watch(watch_dir, shell(cmd), delay=1)
    server.serve(
        root=join(project_dir, "dist", "docs", "html"),
        host="127.0.0.1",
        port="8000",
    )
