From 76382f30684fc9486973d5f62d59613d24774d82 Mon Sep 17 00:00:00 2001 From: Andreas Date: Thu, 15 Feb 2024 18:01:12 +0100 Subject: CLI option --doc_out_path . This CLI option specifies the output directory path for documentation files (eg. 'doc.json'). --- script/cli/doc.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'script/cli/doc.lua') diff --git a/script/cli/doc.lua b/script/cli/doc.lua index 9140a258..4e9941a4 100644 --- a/script/cli/doc.lua +++ b/script/cli/doc.lua @@ -292,6 +292,18 @@ function export.export(outputPath, callback) return docPath, mdPath end +function export.getDocOutputPath() + local doc_output_path = '' + if type(DOC_OUT_PATH) == 'string' then + doc_output_path = fs.absolute(fs.path(DOC_OUT_PATH)):string() + elseif DOC_OUT_PATH == true then + doc_output_path = fs.current_path():string() + else + doc_output_path = LOGPATH + end + return doc_output_path +end + ---@async ---@param outputPath string function export.makeDoc(outputPath) @@ -350,7 +362,7 @@ function export.runCLI() ws.awaitReady(rootUri) await.sleep(0.1) - local docPath, mdPath = export.export(LOGPATH, function (i, max) + local docPath, mdPath = export.export(export.getDocOutputPath(), function (i, max) if os.clock() - lastClock > 0.2 then lastClock = os.clock() local output = '\x0D' -- cgit v1.2.3