Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 45 additions & 20 deletions git_story/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,59 @@
from manim import config, WHITE
from manim.utils.file_ops import open_file as open_media_file


def main():
parser = argparse.ArgumentParser("git-story", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("--commits", help="The number of commits to display in the Git animation", type=int, default=8)
parser.add_argument("--commit-id", help="The ref (branch/tag), or first 6 characters of the commit to animate backwards from", type=str, default="HEAD")
parser.add_argument("--hide-merged-chains", help="Hide commits from merged branches, i.e. only display mainline commits", action="store_true")
parser.add_argument("--reverse", help="Display commits in reverse order in the Git animation", action="store_true")
parser.add_argument("--title", help="Custom title to display at the beginning of the animation", type=str, default="Git Story, by initialcommit.com")
parser.add_argument("--logo", help="The path to a custom logo to use in the animation intro/outro", type=str, default=os.path.join(str(pathlib.Path(__file__).parent.resolve()), "logo.png"))
parser.add_argument("--outro-top-text", help="Custom text to display above the logo during the outro", type=str, default="Thanks for using Initial Commit!")
parser.add_argument("--outro-bottom-text", help="Custom text to display below the logo during the outro", type=str, default="Learn more at initialcommit.com")
parser.add_argument("--show-intro", help="Add an intro sequence with custom logo and title", action="store_true")
parser.add_argument("--show-outro", help="Add an outro sequence with custom logo and text", action="store_true")
parser.add_argument("--max-branches-per-commit", help="Maximum number of branch labels to display for each commit", type=int, default=2)
parser.add_argument("--max-tags-per-commit", help="Maximum number of tags to display for each commit", type=int, default=1)
parser.add_argument("--media-dir", help="The path to output the animation data and video file", type=str, default=".")
parser.add_argument("--low-quality", help="Render output video in low quality, useful for faster testing", action="store_true")
parser.add_argument("--light-mode", help="Enable light-mode with white background", action="store_true")
parser.add_argument("--invert-branches", help="Invert positioning of branches where applicable", action="store_true")
parser.add_argument("--speed", help="A multiple of the standard 1x animation speed (ex: 2 = twice as fast, 0.5 = half as fast)", type=float, default=1)
parser = argparse.ArgumentParser(
"git-story", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument(
"--commits", help="The number of commits to display in the Git animation", type=int, default=8)
parser.add_argument(
"--commit-id", help="The ref (branch/tag), or first 6 characters of the commit to animate backwards from", type=str, default="HEAD")
parser.add_argument("--hide-merged-chains",
help="Hide commits from merged branches, i.e. only display mainline commits", action="store_true")
parser.add_argument(
"--reverse", help="Display commits in reverse order in the Git animation", action="store_true")
parser.add_argument("--title", help="Custom title to display at the beginning of the animation",
type=str, default="Git Story, by initialcommit.com")
parser.add_argument("--logo", help="The path to a custom logo to use in the animation intro/outro",
type=str, default=os.path.join(str(pathlib.Path(__file__).parent.resolve()), "logo.png"))
parser.add_argument("--outro-top-text", help="Custom text to display above the logo during the outro",
type=str, default="Thanks for using Initial Commit!")
parser.add_argument("--outro-bottom-text", help="Custom text to display below the logo during the outro",
type=str, default="Learn more at initialcommit.com")
parser.add_argument(
"--show-intro", help="Add an intro sequence with custom logo and title", action="store_true")
parser.add_argument(
"--show-outro", help="Add an outro sequence with custom logo and text", action="store_true")
parser.add_argument("--max-branches-per-commit",
help="Maximum number of branch labels to display for each commit", type=int, default=2)
parser.add_argument("--max-tags-per-commit",
help="Maximum number of tags to display for each commit", type=int, default=1)
parser.add_argument(
"--media-dir", help="The path to output the animation data and video file", type=str, default=".")
parser.add_argument(
"--low-quality", help="Render output video in low quality, useful for faster testing", action="store_true")
parser.add_argument(
"--light-mode", help="Enable light-mode with white background", action="store_true")
parser.add_argument(
"--invert-branches", help="Invert positioning of branches where applicable", action="store_true")
# disable caching to avoid issues with long animations
parser.add_argument(
"--disable-caching", help="Disable caching to avoid issues with long animations", action="store_true")
parser.add_argument(
"--speed", help="A multiple of the standard 1x animation speed (ex: 2 = twice as fast, 0.5 = half as fast)", type=float, default=1)

args = parser.parse_args()

config.media_dir = os.path.join(args.media_dir, "git-story_media")

if ( args.low_quality ):
if (args.low_quality):
config.quality = "low_quality"

if ( args.light_mode ):
if (args.light_mode):
config.background_color = WHITE
if (args.disable_caching):
config.disable_caching = True

scene = gs.GitStory(args)
scene.render()
Expand All @@ -43,5 +67,6 @@ def main():
except FileNotFoundError:
print("Error automatically opening video player, please manually open the video file to view animation.")


if __name__ == '__main__':
main()