ldoc -m module.function now works: output is still very ugly

This commit is contained in:
Steve Donovan 2011-04-14 15:53:48 +02:00
parent 5fdf0f484d
commit 7d36bf8c5e
2 changed files with 18 additions and 3 deletions

View File

@ -318,7 +318,8 @@ function Item:dump(verbose)
name = name .. self.args name = name .. self.args
end end
if verbose then if verbose then
print(self.type,name,self.summary) print(self.type,name)
print(self.summary)
if self.description then print(self.description) end if self.description then print(self.description) end
for _,p in ipairs(self.params) do for _,p in ipairs(self.params) do
print(p,self.params[p]) print(p,self.params[p])

View File

@ -357,7 +357,15 @@ end
-- ldoc -m is expecting a Lua package; this converts this to a file path -- ldoc -m is expecting a Lua package; this converts this to a file path
if args.module then if args.module then
local fullpath,lua = path.package_path(args.file) local fullpath,lua = path.package_path(args.file)
if not fullpath then quit("module "..args.file.." not found on module path") end if not fullpath then
local mpath,name = tools.split_dotted_name(args.file)
fullpath,lua = path.package_path(mpath)
if not fullpath then
quit("module "..args.file.." not found on module path")
else
args.module = name
end
end
if not lua then quit("module "..args.file.." is a binary extension") end if not lua then quit("module "..args.file.." is a binary extension") end
args.file = fullpath args.file = fullpath
end end
@ -434,7 +442,13 @@ end)
-- using -v will make it more verbose -- using -v will make it more verbose
if args.module then if args.module then
if #module_list == 0 then quit("no modules found") end if #module_list == 0 then quit("no modules found") end
F:dump(args.verbose) if args.module == true then
F:dump(args.verbose)
else
local fun = module_list[1].items.by_name[args.module]
if not fun then quit(args.module.." is not part of this module") end
fun:dump(true)
end
return return
end end