From 1afd1e6f2725998d9495ddf8ebfabdd3c9ff83bf Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Tue, 29 Apr 2014 10:03:40 +0100 Subject: [PATCH] elua: getopt api improvement --- src/bin/elua/lualian.lua | 4 +--- src/bin/elua/modules/getopt.lua | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/bin/elua/lualian.lua b/src/bin/elua/lualian.lua index 35969a70fe..76e4f4a541 100644 --- a/src/bin/elua/lualian.lua +++ b/src/bin/elua/lualian.lua @@ -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) diff --git a/src/bin/elua/modules/getopt.lua b/src/bin/elua/modules/getopt.lua index 40f1ebc2dc..e2b4182abb 100644 --- a/src/bin/elua/modules/getopt.lua +++ b/src/bin/elua/modules/getopt.lua @@ -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