From d4b5120dfd4af3bc1c6eb94f2b1859a189f7079c Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 4 Jan 2023 20:57:53 -0400 Subject: clean traces in REPL (if enabled) --- src/repl.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/repl.js b/src/repl.js index 69e2fe0..f6f78bf 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)), }), }); -- cgit 1.3.0-6-gf8a5