mirror of
https://github.com/TangentFoxy/argparse.git
synced 2025-07-28 02:52:20 +00:00
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:
@@ -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
|
||||
|
Reference in New Issue
Block a user