From 782a350e1f56292176ac8471195c889e47b2b841 Mon Sep 17 00:00:00 2001 From: Christoph Schlosser Date: Sun, 24 Aug 2025 12:53:59 +0200 Subject: g2h:Add branches, tags and project name to overview page --- g2h/cli.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'g2h/cli.py') diff --git a/g2h/cli.py b/g2h/cli.py index 1979045..301203c 100644 --- a/g2h/cli.py +++ b/g2h/cli.py @@ -1,4 +1,6 @@ import argparse +import os + from .git import Git from .gen import Generator @@ -6,16 +8,24 @@ def parse_args(): parser = argparse.ArgumentParser( prog='g2h', description='Convert a git repository into markdown files Hugo can understand.') + # TODO: Defaults for these two values should be $PWD. parser.add_argument('repo_path', help='Path to the root of git repository') parser.add_argument('out_dir', help='Path to where the generated files should be stored') + parser.add_argument('--name', help='Name of the project. Default: directory name of repo') return parser.parse_args() def main(): args = parse_args() git = Git(args.repo_path) + + branches = git.get_branches() + # TODO: Fix this for repo_path=(.|~) + project_name = args.name if args.name is not None else os.path.basename(args.repo_path) + tags = git.get_tags() + gen = Generator(args.out_dir) - gen.render_overview(git.get_all_commits()) + gen.render_overview(project_name, branches, tags) if __name__ == '__main__': main() -- cgit v1.2.3