🔨 Update docs.py script to enable dirty reload conditionally (#11986)

This commit is contained in:
Sebastián Ramírez 2024-08-09 16:30:19 -05:00 committed by GitHub
parent 2b7fc3f340
commit 06fc1c2cc8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 4 deletions

View File

@ -251,6 +251,7 @@ def live(
lang: str = typer.Argument( lang: str = typer.Argument(
None, callback=lang_callback, autocompletion=complete_existing_lang None, callback=lang_callback, autocompletion=complete_existing_lang
), ),
dirty: bool = False,
) -> None: ) -> None:
""" """
Serve with livereload a docs site for a specific language. Serve with livereload a docs site for a specific language.
@ -265,11 +266,12 @@ def live(
if lang is None: if lang is None:
lang = "en" lang = "en"
lang_path: Path = docs_path / lang 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( subprocess.run(
["mkdocs", "serve", "--dev-addr", "127.0.0.1:8008", "--dirty"], args, env={**os.environ, "LINENUMS": "true"}, cwd=lang_path, check=True
env={**os.environ, "LINENUMS": "true"},
cwd=lang_path,
check=True,
) )