]> git.ipfire.org Git - thirdparty/fastapi/sqlmodel.git/commitdiff
🔨 Update docs.py script to enable dirty reload conditionally (#1060)
authorSebastián Ramírez <tiangolo@gmail.com>
Fri, 9 Aug 2024 21:28:38 +0000 (16:28 -0500)
committerGitHub <noreply@github.com>
Fri, 9 Aug 2024 21:28:38 +0000 (16:28 -0500)
scripts/docs.py

index 8efcdda58ab463247456f4ff4e1001d888920c9d..d018ace86fb4c6c0e251d00276471341f45c2aa0 100644 (file)
@@ -104,7 +104,7 @@ def verify_readme() -> None:
 
 
 @app.command()
-def live() -> None:
+def live(dirty: bool = False) -> None:
     """
     Serve with livereload a docs site for a specific language.
 
@@ -115,11 +115,10 @@ def live() -> None:
     en.
     """
     # Enable line numbers during local development to make it easier to highlight
-    subprocess.run(
-        ["mkdocs", "serve", "--dev-addr", "127.0.0.1:8008", "--dirty"],
-        env={**os.environ, "LINENUMS": "true"},
-        check=True,
-    )
+    args = ["mkdocs", "serve", "--dev-addr", "127.0.0.1:8008"]
+    if dirty:
+        args.append("--dirty")
+    subprocess.run(args, env={**os.environ, "LINENUMS": "true"}, check=True)
 
 
 @app.command()