Make the module a table with __call metamethod, add .version field

There is little reason to use `_VERSION` instead of `version`.
`_VERSION` global is used by Lua itself, but module tables don't
have to worry about namespace clashes.
This commit is contained in:
Peter Melnichenko
2018-04-08 15:25:10 +03:00
parent 621d5d2709
commit 46d9182184

View File

@@ -1389,6 +1389,12 @@ function Parser:pparse(args)
end
end
return function(...)
local argparse = {}
argparse.version = "0.5.0"
setmetatable(argparse, {__call = function(_, ...)
return Parser(default_cmdline[0]):add_help(true)(...)
end
end})
return argparse