From 06fc1c2cc82bc585d0e695d57b1d7c7a0c2e0a67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Fri, 9 Aug 2024 16:30:19 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20Update=20docs.py=20script=20to?= =?UTF-8?q?=20enable=20dirty=20reload=20conditionally=20(#11986)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/docs.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/docs.py b/scripts/docs.py index fd2dd78f1..5ef548889 100644 --- a/scripts/docs.py +++ b/scripts/docs.py @@ -251,6 +251,7 @@ def live( lang: str = typer.Argument( None, callback=lang_callback, autocompletion=complete_existing_lang ), + dirty: bool = False, ) -> None: """ Serve with livereload a docs site for a specific language. @@ -265,11 +266,12 @@ def live( if lang is None: lang = "en" lang_path: Path = docs_path / lang + # Enable line numbers during local development to make it easier to highlight + args = ["mkdocs", "serve", "--dev-addr", "127.0.0.1:8008"] + if dirty: + args.append("--dirty") subprocess.run( - ["mkdocs", "serve", "--dev-addr", "127.0.0.1:8008", "--dirty"], - env={**os.environ, "LINENUMS": "true"}, - cwd=lang_path, - check=True, + args, env={**os.environ, "LINENUMS": "true"}, cwd=lang_path, check=True )