Skip to content

Commit 7848d03

Browse files
authored
Merge pull request #2526 from AndreasMatthias/doc-output-path
CLI option --doc_out_path <PATH>.
2 parents 6c224b7 + 76382f3 commit 7848d03

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

script/cli/doc.lua

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,18 @@ function export.export(outputPath, callback)
297297
return docPath, mdPath
298298
end
299299

300+
function export.getDocOutputPath()
301+
local doc_output_path = ''
302+
if type(DOC_OUT_PATH) == 'string' then
303+
doc_output_path = fs.absolute(fs.path(DOC_OUT_PATH)):string()
304+
elseif DOC_OUT_PATH == true then
305+
doc_output_path = fs.current_path():string()
306+
else
307+
doc_output_path = LOGPATH
308+
end
309+
return doc_output_path
310+
end
311+
300312
---@async
301313
---@param outputPath string
302314
function export.makeDoc(outputPath)
@@ -355,7 +367,7 @@ function export.runCLI()
355367
ws.awaitReady(rootUri)
356368
await.sleep(0.1)
357369

358-
local docPath, mdPath = export.export(LOGPATH, function (i, max)
370+
local docPath, mdPath = export.export(export.getDocOutputPath(), function (i, max)
359371
if os.clock() - lastClock > 0.2 then
360372
lastClock = os.clock()
361373
local output = '\x0D'

script/global.d.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ CHECK = ''
5252
---@type string
5353
DOC = ''
5454

55+
--output directory path for documentation (doc.json, ...)
56+
---@type string
57+
DOC_OUT_PATH = ''
58+
5559
---@type string | '"Error"' | '"Warning"' | '"Information"' | '"Hint"'
5660
CHECKLEVEL = 'Warning'
5761

0 commit comments

Comments
 (0)