|
3 | 3 | import click
|
4 | 4 | import cloup
|
5 | 5 |
|
6 |
| -from . import __version__, cli_ctx_settings, console |
7 |
| -from .cli.cfg.group import cfg |
8 |
| -from .cli.checkhealth.commands import checkhealth |
9 |
| -from .cli.default_group import DefaultGroup |
10 |
| -from .cli.init.commands import init |
11 |
| -from .cli.plugins.commands import plugins |
12 |
| -from .cli.render.commands import render |
13 |
| -from .constants import EPILOG |
| 6 | +from manim import __version__ |
| 7 | +from manim._config import cli_ctx_settings, console |
| 8 | +from manim.cli.cfg.group import cfg |
| 9 | +from manim.cli.checkhealth.commands import checkhealth |
| 10 | +from manim.cli.default_group import DefaultGroup |
| 11 | +from manim.cli.init.commands import init |
| 12 | +from manim.cli.plugins.commands import plugins |
| 13 | +from manim.cli.render.commands import render |
| 14 | +from manim.constants import EPILOG |
14 | 15 |
|
15 | 16 |
|
16 |
| -def show_splash(ctx, param, value): |
| 17 | +def show_splash(ctx: click.Context, param: click.Option, value: str | None) -> None: |
| 18 | + """When giving a value by console, show an initial message with the Manim |
| 19 | + version before executing any other command: ``Manim Community vA.B.C``. |
| 20 | +
|
| 21 | + Parameters |
| 22 | + ---------- |
| 23 | + ctx |
| 24 | + The Click context. |
| 25 | + param |
| 26 | + A Click option. |
| 27 | + value |
| 28 | + A string value given by console, or None. |
| 29 | + """ |
17 | 30 | if value:
|
18 | 31 | console.print(f"Manim Community [green]v{__version__}[/green]\n")
|
19 | 32 |
|
20 | 33 |
|
21 |
| -def print_version_and_exit(ctx, param, value): |
| 34 | +def print_version_and_exit( |
| 35 | + ctx: click.Context, param: click.Option, value: str | None |
| 36 | +) -> None: |
| 37 | + """Same as :func:`show_splash`, but also exit when giving a value by |
| 38 | + console. |
| 39 | +
|
| 40 | + Parameters |
| 41 | + ---------- |
| 42 | + ctx |
| 43 | + The Click context. |
| 44 | + param |
| 45 | + A Click option. |
| 46 | + value |
| 47 | + A string value given by console, or None. |
| 48 | + """ |
22 | 49 | show_splash(ctx, param, value)
|
23 | 50 | if value:
|
24 | 51 | ctx.exit()
|
@@ -53,8 +80,14 @@ def print_version_and_exit(ctx, param, value):
|
53 | 80 | expose_value=False,
|
54 | 81 | )
|
55 | 82 | @cloup.pass_context
|
56 |
| -def main(ctx): |
57 |
| - """The entry point for manim.""" |
| 83 | +def main(ctx: click.Context) -> None: |
| 84 | + """The entry point for Manim. |
| 85 | +
|
| 86 | + Parameters |
| 87 | + ---------- |
| 88 | + ctx |
| 89 | + The Click context. |
| 90 | + """ |
58 | 91 | pass
|
59 | 92 |
|
60 | 93 |
|
|
0 commit comments