--- a/src/main.cpp Sat Feb 01 17:15:14 2025 +0100 +++ b/src/main.cpp Mon Feb 03 23:13:19 2025 +0100 @@ -43,8 +43,9 @@ " -a, --author <name> Only report this author\n" " (repeat option to report multiple authors)\n" " -A, --authormap <file> Apply an author mapping file\n" + " -d, --depth <num> The search depth (default: 1, max: 255)\n" + " -f, --fragment Output as fragment\n" " -h, --help Print this help message\n" - " -d, --depth <num> The search depth (default: 1, max: 255)\n" " -n, --no-pull Do not pull the repositories\n" " -s, --separate Output a separate heat map for each repository\n" " -y, --year <year> The year for which to create the heat map\n" @@ -78,7 +79,9 @@ "Finally, this tool prints an HTML page to stdout. A separate heap map is\n" "generated for each author showing commits across all repositories, unless the\n" "\033[1m--separate\033[22m option is specified in which case each repository is displayed with\n" - "its own heat map.\n" + "its own heat map. By using the \033[1m--fragment\033[22m option, the tool only outputs a\n" + "single HTML div container without any header or footer that can be embedded in\n" + "your custom web page.\n" , stderr); } @@ -124,6 +127,8 @@ } } else if (chk_arg(argv[i], "-n", "--no-pull")) { settings.update_repos = false; + } else if (chk_arg(argv[i], "-f", "--fragment")) { + settings.fragment = true; } else if (chk_arg(argv[i], "-s", "--separate")) { settings.separate = true; } else if (chk_arg(argv[i], "-A", "--authormap")) { @@ -249,7 +254,7 @@ } } - html::open(); + html::open(settings.fragment); for (const auto &[repo, authors] : heatmap.data()) { html::h1(repo); for (const auto &[author, entries] : authors) { @@ -313,7 +318,7 @@ html::table_end(); } } - html::close(); + html::close(settings.fragment); return EXIT_SUCCESS; }