Add command line option for displaying version information:
- Creates version option ('-V' or '--version'). - Allows invoking 'ldoc --version' without 'file' parameter.
This commit is contained in:
parent
7a94466936
commit
1ba5167190
12
ldoc.lua
12
ldoc.lua
|
@ -41,8 +41,10 @@ ldoc, a documentation generator for Lua, v]]..version..[[
|
||||||
|
|
||||||
Invocation:
|
Invocation:
|
||||||
ldoc [options] <file>
|
ldoc [options] <file>
|
||||||
|
ldoc --version
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
-V,--version show version information
|
||||||
-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
|
||||||
|
@ -74,7 +76,7 @@ ldoc, a documentation generator for Lua, v]]..version..[[
|
||||||
--fatalwarnings non-zero exit status on any warning
|
--fatalwarnings non-zero exit status on any warning
|
||||||
--testing reproducible build; no date or version on output
|
--testing reproducible build; no date or version on output
|
||||||
|
|
||||||
<file> (string) source file or directory containing source
|
<file> (optional string) source file or directory containing source
|
||||||
|
|
||||||
`ldoc .` reads options from an `config.ld` file in same directory;
|
`ldoc .` reads options from an `config.ld` file in same directory;
|
||||||
`ldoc -c path/to/myconfig.ld <file>` reads options from `path/to/myconfig.ld`
|
`ldoc -c path/to/myconfig.ld <file>` reads options from `path/to/myconfig.ld`
|
||||||
|
@ -92,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
|
||||||
|
@ -349,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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue