-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmkdocs.py
More file actions
35 lines (29 loc) · 1.36 KB
/
mkdocs.py
File metadata and controls
35 lines (29 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""MkDocs tool implementation."""
from __future__ import annotations
from typing import final
from typing_extensions import assert_never, override
from usethis._backend.dispatch import get_backend
from usethis._backend.poetry.detect import is_poetry_used
from usethis._backend.uv.detect import is_uv_used
from usethis._console import how_print
from usethis._tool.base import Tool
from usethis._tool.impl.spec.mkdocs import MkDocsToolSpec
from usethis._types.backend import BackendEnum
@final
class MkDocsTool(MkDocsToolSpec, Tool):
@override
def print_how_to_use(self) -> None:
backend = get_backend()
if backend is BackendEnum.uv and is_uv_used():
how_print("Run 'uv run mkdocs build' to build the documentation.")
how_print("Run 'uv run mkdocs serve' to serve the documentation locally.")
elif backend is BackendEnum.poetry and is_poetry_used():
how_print("Run 'poetry run mkdocs build' to build the documentation.")
how_print(
"Run 'poetry run mkdocs serve' to serve the documentation locally."
)
elif backend in (BackendEnum.none, BackendEnum.uv, BackendEnum.poetry):
how_print("Run 'mkdocs build' to build the documentation.")
how_print("Run 'mkdocs serve' to serve the documentation locally.")
else:
assert_never(backend)