elua: getopt api improvement

This commit is contained in:
Daniel Kolesa 2014-04-29 10:03:40 +01:00 committed by Daniel Kolesa
parent 3130a0ec20
commit 1afd1e6f27
2 changed files with 2 additions and 4 deletions

View File

@ -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)

View File

@ -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