« get me outta code hell

clean traces in REPL (if enabled) - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/repl.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-01-04 20:57:53 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-01-04 20:57:53 -0400
commitd4b5120dfd4af3bc1c6eb94f2b1859a189f7079c (patch)
tree48776b6e53960d7c7f196e1f0dea5c0455821a8f /src/repl.js
parentd788e5dc790c7bd3f98ccd7c6dca7794e575a133 (diff)
clean traces in REPL (if enabled)
Diffstat (limited to 'src/repl.js')
-rw-r--r--src/repl.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/repl.js b/src/repl.js
index 69e2fe05..f6f78bf0 100644
--- a/src/repl.js
+++ b/src/repl.js
@@ -19,6 +19,8 @@ import _find, {bindFind} from './util/find.js';
 
 import urlSpec from './url-spec.js';
 
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
+
 export async function getContextAssignments({
   wikiData,
 }) {
@@ -84,10 +86,15 @@ async function main() {
     'no-history': {
       type: 'flag',
     },
+
+    'show-traces': {
+      type: 'flag',
+    },
   });
 
   const dataPath = miscOptions['data-path'] || process.env.HSMUSIC_DATA;
   const disableHistory = miscOptions['no-history'] ?? false;
+  const showTraces = miscOptions['show-traces'] ?? false;
 
   if (!dataPath) {
     logError`Expected --data-path option or HSMUSIC_DATA to be set`;
@@ -98,7 +105,8 @@ async function main() {
 
   const wikiData = await quickLoadAllFromYAML(dataPath, {
     showAggregate: bindOpts(showAggregate, {
-      showTraces: false,
+      showTraces,
+      pathToFileURL: (f) => path.relative(__dirname, fileURLToPath(f)),
     }),
   });