Skip to content

Commit e7eef3c

Browse files
Add global option --highlight-commit-messages to make commit message text bigger and bold, and hide commit ids
Signed-off-by: Jacob Stopak <jacob@initialcommit.io>
1 parent df19c31 commit e7eef3c

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

Diff for: README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ The `[global options]` apply to the overarching `git-sim` simulation itself, inc
147147
`--img-format`: Output format for the image file, i.e. `jpg` or `png`. Default output format is `jpg`.
148148
`--stdout`: Write raw image data to stdout while suppressing all other program output.
149149
`--output-only-path`: Only output the path to the generated media file to stdout. Useful for other programs to ingest.
150-
`--quiet, -q`: Suppress all output except errors.
150+
`--quiet, -q`: Suppress all output except errors.
151+
`--highlight-commit-messages`: Make commit message text bigger and bold, and hide commit ids.
151152

152153
Animation-only global options (to be used in conjunction with `--animate`):
153154

Diff for: git_sim/__main__.py

+5
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ def main(
125125
settings.color_by,
126126
help="Color commits by parameter, such as author",
127127
),
128+
highlight_commit_messages: bool = typer.Option(
129+
settings.highlight_commit_messages,
130+
help="Make the displayed commit messages more prominent",
131+
),
128132
):
129133
import git
130134
from manim import config, WHITE
@@ -154,6 +158,7 @@ def main(
154158
settings.hide_merged_branches = hide_merged_branches
155159
settings.all = all
156160
settings.color_by = color_by
161+
settings.highlight_commit_messages = highlight_commit_messages
157162

158163
try:
159164
if sys.platform == "linux" or sys.platform == "darwin":

Diff for: git_sim/git_sim_base_command.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -305,30 +305,34 @@ def draw_commit(self, commit, i, prevCircle, shift=numpy.array([0.0, 0.0, 0.0]))
305305
commitMessage[j : j + 20] for j in range(0, len(commitMessage), 20)
306306
)[:100],
307307
font="Monospace",
308-
font_size=14,
308+
font_size=20 if settings.highlight_commit_messages else 14,
309309
color=self.fontColor,
310+
weight=m.BOLD if settings.highlight_commit_messages else m.NORMAL,
310311
).next_to(circle, m.DOWN)
311312

312313
if settings.animate and commit != "dark" and isNewCommit:
313314
self.play(
314315
self.camera.frame.animate.move_to(circle.get_center()),
315316
m.Create(circle),
316-
m.AddTextLetterByLetter(commitId),
317+
m.Text("") if settings.highlight_commit_messages else m.AddTextLetterByLetter(commitId),
317318
m.AddTextLetterByLetter(message),
318319
run_time=1 / settings.speed,
319320
)
320321
elif isNewCommit:
321-
self.add(circle, commitId, message)
322+
self.add(circle, m.Text("") if settings.highlight_commit_messages else commitId, message)
322323
else:
323-
return commitId, circle, arrow, hide_refs
324+
return m.Text("") if settings.highlight_commit_messages else commitId, circle, arrow, hide_refs
324325

325326
if commit != "dark":
326327
self.drawnCommits[commit.hexsha] = circle
327328
group = m.Group(circle, commitId, message)
328329
self.add_group_to_author_groups(commit.author.name, group)
329330

330331
self.toFadeOut.add(circle, commitId, message)
331-
self.prevRef = commitId
332+
if settings.highlight_commit_messages:
333+
self.prevRef = circle
334+
else:
335+
self.prevRef = commitId
332336

333337
return commitId, circle, arrow, hide_refs
334338

@@ -362,7 +366,10 @@ def draw_head(self, commit, i, commitId):
362366
headbox = m.Rectangle(color=m.BLUE, fill_color=m.BLUE, fill_opacity=0.25)
363367
headbox.width = 1
364368
headbox.height = 0.4
365-
headbox.next_to(commitId, m.UP)
369+
if settings.highlight_commit_messages:
370+
headbox.next_to(self.drawnCommits[commit.hexsha], m.UP)
371+
else:
372+
headbox.next_to(commitId, m.UP)
366373
headText = m.Text(
367374
"HEAD", font="Monospace", font_size=20, color=self.fontColor
368375
).move_to(headbox.get_center())

Diff for: git_sim/settings.py

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class Settings(BaseSettings):
4646
hide_merged_branches = False
4747
all = False
4848
color_by: Union[str, None] = None
49+
highlight_commit_messages = False
4950

5051
class Config:
5152
env_prefix = "git_sim_"

0 commit comments

Comments
 (0)