@@ -131,7 +131,7 @@ function M.process_args(args, parser)
131131
132132 if not ok or not m then
133133 parser :error (' unknown luaJIT command or ' ..
134- ' jit.* modules not installed' )
134+ ' jit.* modules not installed' )
135135 end
136136
137137 m .start (unpack (_args ))
224224--- @param configs string[] | nil
225225function M .source_configs (configs )
226226 configs = configs or { os.getenv (' HOME' ) .. ' /.luaprc.lua' ,
227- os.getenv (' HOME' ) .. ' /.config/luaprc.lua' }
227+ os.getenv (' HOME' ) .. ' /.config/luaprc.lua' }
228228 for _ , name in ipairs (configs ) do
229229 local f = io.open (name , " r" )
230230 if f ~= nil then
@@ -240,5 +240,20 @@ function M.source_configs(configs)
240240 end
241241end
242242
243+ --- **entry for pandocp**
244+ --- @param argv string[] command line arguments
245+ --- @param configs string[] | nil ` nil` means default ` ~/.config/luaprc.lua`
246+ --- @param callback function | nil handle ` args`
247+ function M .main (argv , configs , callback )
248+ M .init ()
249+ M .source_configs (configs )
250+ local parser = M .get_parser ()
251+ local args = parser :parse (argv )
252+ if callback then
253+ args = callback (args )
254+ end
255+ M .process_args (args , parser )
256+ end
257+
243258--- @export
244259return M
0 commit comments