« get me outta code hell

upd8: --show-url-spec - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-01-17 09:14:06 -0400
committer(quasar) nebula <qznebula@protonmail.com>2025-01-17 09:14:06 -0400
commit20af704fe3ac97011a7c7f3b1eec595c20518fdb (patch)
tree421584406a61225a2616c1efc66b366c9288e998
parentc16763bb2e86e08ca0943562767322139b04f0c6 (diff)
upd8: --show-url-spec
-rwxr-xr-xsrc/upd8.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/upd8.js b/src/upd8.js
index 187be4cc..ab369573 100755
--- a/src/upd8.js
+++ b/src/upd8.js
@@ -342,6 +342,11 @@ async function main() {
       type: 'value',
     },
 
+    'show-url-spec': {
+      help: `Displays the entire computed URL spec, after the data folder's default override and optional specs are applied. This is mostly useful for progammer debugging!`,
+      type: 'flag',
+    },
+
     'skip-directory-validation': {
       help: `Skips checking for duplicated directories, which speeds up the build but may cause the wiki to catch on fire`,
       type: 'flag',
@@ -584,6 +589,7 @@ async function main() {
   const precacheMode = cliOptions['precache-mode'] ?? 'common';
 
   const wantedURLSpecKeys = cliOptions['urls'] ?? [];
+  const showURLSpec = cliOptions['show-url-spec'] ?? false;
 
   // Makes writing nicer on the CPU and file I/O parts of the OS, with a
   // marginal performance deficit while waiting for file writes to finish
@@ -1961,6 +1967,16 @@ async function main() {
     return false;
   }
 
+  if (showURLSpec) {
+    if (!paragraph) console.log('');
+
+    logInfo`Here's the final URL spec, via ${'--show-url-spec'}:`
+    console.log(urlSpec);
+    console.log('');
+
+    paragraph = true;
+  }
+
   Object.assign(stepStatusSummary.loadURLFiles, {
     status: STATUS_DONE_CLEAN,
     timeEnd: Date.now(),