elua: getopt api improvement
This commit is contained in:
parent
3130a0ec20
commit
1afd1e6f27
|
@ -4,7 +4,7 @@
|
|||
local lualian = require("lualian")
|
||||
local getopt = require("getopt")
|
||||
|
||||
local arg_parser = {
|
||||
local opts, args, arg_parser = getopt.parse {
|
||||
usage = "Usage: %prog [OPTIONS] file1.eo file2.eo ... fileN.eo",
|
||||
args = arg, descs = {
|
||||
{ "h", "help" , false, help = "Show this message." },
|
||||
|
@ -23,8 +23,6 @@ local arg_parser = {
|
|||
}
|
||||
}
|
||||
|
||||
local opts, args = getopt.parse(arg_parser)
|
||||
|
||||
if not opts then
|
||||
io.stderr:write(args, "\n")
|
||||
getopt.help(arg_parser, io.stderr)
|
||||
|
|
|
@ -98,7 +98,7 @@ M.parse = function(parser)
|
|||
if not ret then
|
||||
return nil, opts
|
||||
end
|
||||
return opts, args
|
||||
return opts, args, parser
|
||||
end
|
||||
local parse = M.parse
|
||||
|
||||
|
|
Loading…
Reference in New Issue