@@ -41,7 +41,7 @@ local function getPathDocUpdate()
4141 return section .DOC
4242 end
4343 end
44- end )
44+ end )
4545 if ok then
4646 local doc_json_dir = doc_json_path :string ():gsub (' /doc.json' , ' ' )
4747 return doc_json_dir , doc_path
@@ -131,7 +131,7 @@ local function injectBuildScript()
131131 },
132132 {__index = _G }))
133133 if err or not data then
134- error (err , 0 )
134+ error (err , 0 )
135135 end
136136 data ()
137137 return module
@@ -193,6 +193,15 @@ function doc.runCLI()
193193
194194 print (' root uri = ' .. rootUri )
195195
196+ --- If '--configpath' is specified, get the folder path of the '.luarc.doc.json' configuration file (without the file name)
197+ --- 如果指定了'--configpath',则获取`.luarc.doc.json` 配置文件的文件夹路径(不包含文件名)
198+ --- This option is passed into the callback function of the initialized method in provide.
199+ --- 该选项会被传入到`provide`中的`initialized`方法的回调函数中
200+ local luarcParentUri
201+ if CONFIGPATH then
202+ luarcParentUri = furi .encode (fs .absolute (fs .path (CONFIGPATH )):parent_path ():string ())
203+ end
204+
196205 util .enableCloseFunction ()
197206
198207 local lastClock = os.clock ()
@@ -203,6 +212,7 @@ function doc.runCLI()
203212
204213 client :initialize {
205214 rootUri = rootUri ,
215+ luarcParentUri = luarcParentUri ,
206216 }
207217 io.write (lang .script (' CLI_DOC_INITING' ))
208218
@@ -222,11 +232,11 @@ function doc.runCLI()
222232 if os.clock () - lastClock > 0.2 then
223233 lastClock = os.clock ()
224234 local output = ' \x0D '
225- .. (' >' ):rep (math.ceil (i / max * 20 ))
226- .. (' =' ):rep (20 - math.ceil (i / max * 20 ))
227- .. ' '
228- .. (' 0' ):rep (# tostring (max ) - # tostring (i ))
229- .. tostring (i ) .. ' /' .. tostring (max )
235+ .. (' >' ):rep (math.ceil (i / max * 20 ))
236+ .. (' =' ):rep (20 - math.ceil (i / max * 20 ))
237+ .. ' '
238+ .. (' 0' ):rep (# tostring (max ) - # tostring (i ))
239+ .. tostring (i ) .. ' /' .. tostring (max )
230240 io.write (output )
231241 end
232242 end )
0 commit comments