Skip to content

Commit 76382f3

Browse files
CLI option --doc_out_path <PATH>.
This CLI option specifies the output directory path for documentation files (eg. 'doc.json').
1 parent a89b343 commit 76382f3

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
@@ -292,6 +292,18 @@ function export.export(outputPath, callback)
292292
return docPath, mdPath
293293
end
294294

295+
function export.getDocOutputPath()
296+
local doc_output_path = ''
297+
if type(DOC_OUT_PATH) == 'string' then
298+
doc_output_path = fs.absolute(fs.path(DOC_OUT_PATH)):string()
299+
elseif DOC_OUT_PATH == true then
300+
doc_output_path = fs.current_path():string()
301+
else
302+
doc_output_path = LOGPATH
303+
end
304+
return doc_output_path
305+
end
306+
295307
---@async
296308
---@param outputPath string
297309
function export.makeDoc(outputPath)
@@ -350,7 +362,7 @@ function export.runCLI()
350362
ws.awaitReady(rootUri)
351363
await.sleep(0.1)
352364

353-
local docPath, mdPath = export.export(LOGPATH, function (i, max)
365+
local docPath, mdPath = export.export(export.getDocOutputPath(), function (i, max)
354366
if os.clock() - lastClock > 0.2 then
355367
lastClock = os.clock()
356368
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)