Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(cli): better cli
Browse files Browse the repository at this point in the history
jeertmans committed Nov 22, 2023

Verified

This commit was signed with the committer’s verified signature.
paescuj Pascal Jufer
1 parent caca213 commit dfd9d63
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions manim_slides/render.py
Original file line number Diff line number Diff line change
@@ -11,7 +11,6 @@
"""

import sys
import subprocess

from typing import Tuple

@@ -20,15 +19,15 @@

@click.command(
context_settings=dict(ignore_unknown_options=True, allow_extra_args=True, help_option_names=("-h",)),
options_metavar="[--CE|--GL]"
options_metavar="[-h] [--CE|--GL]"
)
@click.option(
"--CE",
is_flag=True,
envvar="MANIM_RENDERER",
show_envvar=True,
help="If set, use Manim Community Edition (CE) renderer. "
"If this or --CE is not set, default to CE renderer.",
"If this or --GL is not set, default to CE renderer.",
)
@click.option(
"--GL",
@@ -48,8 +47,14 @@ def render(ce: bool, gl: bool, args: Tuple[str, ...]) -> None:
if ce and gl:
raise click.UsageError("You cannot specify both --CE and --GL renderers.")
if gl:
module = "manimlib"
from manimlib.__main__ import main

sys.argv[0] = "manimgl"
sys.argv[1:] = args

main()
else:
module = "manim"
from manim.cli.render.commands import render

subprocess.run([sys.executable, "-m", module, *args])
sys.argv[0] = "manim render"
render.main(args)

0 comments on commit dfd9d63

Please sign in to comment.