src/main.cpp

changeset 73
707f42bb0484
parent 71
39644afa3808
child 75
857af79337d5
--- a/src/main.cpp	Tue Dec 16 21:23:39 2025 +0100
+++ b/src/main.cpp	Fri Feb 06 16:22:33 2026 +0100
@@ -38,7 +38,7 @@
 
 using namespace std::chrono;
 
-static constexpr auto program_version = "1.1.2";
+static constexpr auto program_version = "1.2.0-preview";
 
 static void print_help() {
     fputs(
@@ -52,6 +52,7 @@
         "   -h, --help                Print this help message\n"
         "   -p, --pull                Try to pull the repositories\n"
         "   -s, --separate            Output a separate heat map for each repository\n"
+        "       --styles-and-script   Output the default CSS and Javascript and quit\n"
         "   -V, --version             Output the version of this program and exit\n"
         "   -y, --year <year>         The year for which to create the heat map\n"
         "       --hg <path>           Path to hg binary (default: /usr/bin/hg)\n"
@@ -88,6 +89,9 @@
         "single HTML div container without any header or footer that can be embedded in\n"
         "your custom web page. You can optionally specify an indentation for that\n"
         "container (default is 0 and maximum is 12).\n"
+        "When you want to combine this with the default style and scripts, you can use\n"
+        "the \033[1m--styles-and-script\033[22m option print the defaults to stdout and redirect them\n"
+        "into a file when you are composing your custom HTML page.\n"
         , stderr);
 }
 
@@ -171,6 +175,12 @@
                 fputs("--git is expecting a path\n", stderr);
                 return -1;
             }
+        } else if (chk_arg(argv[i], "--styles-and-script", nullptr)) {
+            settings.styles_and_script = true;
+            if (argc != 2) {
+                fputs("Error: --styles-and-script must be the only option when present\n", stderr);
+                return -1;
+            }
         } else if (argv[i][0] == '-') {
             fprintf(stderr, "Unknown option: %s\n", argv[i]);
             return -1;
@@ -193,6 +203,12 @@
         return result < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
     }
 
+    // check special options
+    if (settings.styles_and_script) {
+        html::styles_and_script();
+        return 0;
+    }
+
     // check hg and git
     fm::process proc;
     proc.setbin(settings.hg);

mercurial