Skip to content

Commit 639cd26

Browse files
authored
Add -v, --version flag to display program version info (#82)
1 parent 4b9f71c commit 639cd26

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

Diff for: git_sim/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "0.2.9"

Diff for: git_sim/__main__.py

+13
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
app = typer.Typer(context_settings={"help_option_names": ["-h", "--help"]})
1313

1414

15+
def version_callback(value: bool) -> None:
16+
if value:
17+
print(f"git-sim version {git_sim.__version__}")
18+
raise typer.Exit()
19+
20+
1521
@app.callback(no_args_is_help=True)
1622
def main(
1723
ctx: typer.Context,
@@ -134,6 +140,13 @@ def main(
134140
settings.highlight_commit_messages,
135141
help="Make the displayed commit messages more prominent",
136142
),
143+
version: bool = typer.Option(
144+
False,
145+
"--version",
146+
"-v",
147+
help="Show the version of git-sim and exit.",
148+
callback=version_callback,
149+
),
137150
):
138151
import git
139152
from manim import WHITE, config

Diff for: setup.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import setuptools
22

3+
from git_sim import __version__
4+
35
with open("README.md", "r") as fh:
46
long_description = fh.read()
57

68
setuptools.setup(
79
name="git-sim",
8-
version="0.2.9",
10+
version=__version__,
911
author="Jacob Stopak",
1012
author_email="jacob@initialcommit.io",
1113
description="Simulate Git commands on your own repos by generating an image (default) or video visualization depicting the command's behavior.",

0 commit comments

Comments
 (0)