Merge pull request #278 from AntumDeluge/usage_version

This commit is contained in:
Caleb Maclennan 2020-09-30 00:38:44 +03:00 committed by GitHub
commit 55816f7571
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 45 additions and 31 deletions

View File

@ -37,8 +37,13 @@ app.require_here()
--- @usage --- @usage
local usage = [[ local usage = [[
ldoc, a documentation generator for Lua, vs ]]..version..[[ ldoc, a documentation generator for Lua, v]]..version..[[
Invocation:
ldoc [options] <file>
ldoc --version
Options:
-d,--dir (default doc) output directory -d,--dir (default doc) output directory
-o,--output (default 'index') output name -o,--output (default 'index') output name
-v,--verbose verbose -v,--verbose verbose
@ -49,7 +54,7 @@ ldoc, a documentation generator for Lua, vs ]]..version..[[
-l,--template (default !) directory for template (ldoc.ltp) -l,--template (default !) directory for template (ldoc.ltp)
-p,--project (default ldoc) project name -p,--project (default ldoc) project name
-t,--title (default Reference) page title -t,--title (default Reference) page title
-f,--format (default plain) formatting - can be markdown, discount, lunamark, commonmark, backticks, or plain -f,--format (default plain) formatting - can be markdown, discount or plain
-b,--package (default .) top-level package basename (needed for module(...)) -b,--package (default .) top-level package basename (needed for module(...))
-x,--ext (default html) output file extension -x,--ext (default html) output file extension
-c,--config (default config.ld) configuration name -c,--config (default config.ld) configuration name
@ -63,6 +68,7 @@ ldoc, a documentation generator for Lua, vs ]]..version..[[
-M,--merge allow module merging -M,--merge allow module merging
-S,--simple no return or params, no summary -S,--simple no return or params, no summary
-O,--one one-column output layout -O,--one one-column output layout
-V,--version show version information
--date (default system) use this date in generated doc --date (default system) use this date in generated doc
--dump debug output dump --dump debug output dump
--filter (default none) filter output as Lua data (e.g pl.pretty.dump) --filter (default none) filter output as Lua data (e.g pl.pretty.dump)
@ -88,6 +94,11 @@ local KindMap = tools.KindMap
local Item,File,Module = doc.Item,doc.File,doc.Module local Item,File,Module = doc.Item,doc.File,doc.Module
local quit = utils.quit local quit = utils.quit
if args.version then
print('LDoc v' .. version)
os.exit(0)
end
local ModuleMap = class(KindMap) local ModuleMap = class(KindMap)
doc.ModuleMap = ModuleMap doc.ModuleMap = ModuleMap
@ -345,6 +356,9 @@ else
if err then quit("no "..quote(args.config).." found") end if err then quit("no "..quote(args.config).." found") end
end end
-- with user-provided file -- with user-provided file
if args.file == nil then
lapp.error('missing required parameter: file')
end
args.file = abspath(args.file) args.file = abspath(args.file)
end end