add cli flag -v to show version info

This commit is contained in:
TonyCrane 2021-10-06 17:54:28 +08:00
parent fbccb1ebf3
commit ef5253f1bc
3 changed files with 15 additions and 0 deletions

View file

@ -1,3 +1,7 @@
import pkg_resources
__version__ = pkg_resources.get_distribution("manimgl").version
from manimlib.constants import *
from manimlib.animation.animation import *

View file

@ -7,6 +7,12 @@ import manimlib.utils.init_config
def main():
args = manimlib.config.parse_cli()
if args.version:
from manimlib import __version__
print(f"ManimGL v{__version__}")
if args.file == None:
return
if args.config:
manimlib.utils.init_config.init_customization()
else:

View file

@ -136,6 +136,11 @@ def parse_cli():
"--config_file",
help="Path to the custom configuration file",
)
parser.add_argument(
"-v", "--version",
action="store_true",
help="Display the version of manimgl"
)
args = parser.parse_args()
return args
except argparse.ArgumentError as err: