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,38 +37,44 @@ 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..[[
-d,--dir (default doc) output directory Invocation:
-o,--output (default 'index') output name ldoc [options] <file>
-v,--verbose verbose ldoc --version
-a,--all show local functions, etc, in docs
-q,--quiet suppress output Options:
-m,--module module docs as text -d,--dir (default doc) output directory
-s,--style (default !) directory for style sheet (ldoc.css) -o,--output (default 'index') output name
-l,--template (default !) directory for template (ldoc.ltp) -v,--verbose verbose
-p,--project (default ldoc) project name -a,--all show local functions, etc, in docs
-t,--title (default Reference) page title -q,--quiet suppress output
-f,--format (default plain) formatting - can be markdown, discount, lunamark, commonmark, backticks, or plain -m,--module module docs as text
-b,--package (default .) top-level package basename (needed for module(...)) -s,--style (default !) directory for style sheet (ldoc.css)
-x,--ext (default html) output file extension -l,--template (default !) directory for template (ldoc.ltp)
-c,--config (default config.ld) configuration name -p,--project (default ldoc) project name
-u,--unqualified don't show package name in sidebar links -t,--title (default Reference) page title
-i,--ignore ignore any 'no doc comment or no module' warnings -f,--format (default plain) formatting - can be markdown, discount or plain
-X,--not_luadoc break LuaDoc compatibility. Descriptions may continue after tags. -b,--package (default .) top-level package basename (needed for module(...))
-D,--define (default none) set a flag to be used in config.ld -x,--ext (default html) output file extension
-C,--colon use colon style -c,--config (default config.ld) configuration name
-N,--no_args_infer don't infer arguments from source -u,--unqualified don't show package name in sidebar links
-B,--boilerplate ignore first comment in source files -i,--ignore ignore any 'no doc comment or no module' warnings
-M,--merge allow module merging -X,--not_luadoc break LuaDoc compatibility. Descriptions may continue after tags.
-S,--simple no return or params, no summary -D,--define (default none) set a flag to be used in config.ld
-O,--one one-column output layout -C,--colon use colon style
--date (default system) use this date in generated doc -N,--no_args_infer don't infer arguments from source
--dump debug output dump -B,--boilerplate ignore first comment in source files
--filter (default none) filter output as Lua data (e.g pl.pretty.dump) -M,--merge allow module merging
--tags (default none) show all references to given tags, comma-separated -S,--simple no return or params, no summary
--fatalwarnings non-zero exit status on any warning -O,--one one-column output layout
--testing reproducible build; no date or version on output -V,--version show version information
--date (default system) use this date in generated doc
--dump debug output dump
--filter (default none) filter output as Lua data (e.g pl.pretty.dump)
--tags (default none) show all references to given tags, comma-separated
--fatalwarnings non-zero exit status on any warning
--testing reproducible build; no date or version on output
<file> (string) source file or directory containing source <file> (string) source file or directory containing source
@ -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