Skip to content

Commit

Permalink
Merge pull request #2526 from AndreasMatthias/doc-output-path
Browse files Browse the repository at this point in the history
CLI option --doc_out_path <PATH>.
sumneko authored Feb 19, 2024
2 parents 6c224b7 + 76382f3 commit 7848d03
Showing 2 changed files with 17 additions and 1 deletion.
14 changes: 13 additions & 1 deletion script/cli/doc.lua
Original file line number Diff line number Diff line change
@@ -297,6 +297,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)
@@ -355,7 +367,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'
4 changes: 4 additions & 0 deletions script/global.d.lua
Original file line number Diff line number Diff line change
@@ -52,6 +52,10 @@ CHECK = ''
---@type string
DOC = ''

--output directory path for documentation (doc.json, ...)
---@type string
DOC_OUT_PATH = ''

---@type string | '"Error"' | '"Warning"' | '"Information"' | '"Hint"'
CHECKLEVEL = 'Warning'

0 comments on commit 7848d03

Please sign in to comment.