aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--spec/util_argparse_spec.lua2
-rw-r--r--util/argparse.lua7
2 files changed, 6 insertions, 3 deletions
diff --git a/spec/util_argparse_spec.lua b/spec/util_argparse_spec.lua
index 3994a041..0f2430b7 100644
--- a/spec/util_argparse_spec.lua
+++ b/spec/util_argparse_spec.lua
@@ -20,7 +20,7 @@ describe("parse", function()
local arg = { "--foo"; "bar"; "--baz" };
local opts, err = parse(arg);
assert.falsy(err);
- assert.same({ foo = true }, opts);
+ assert.same({ foo = true, "bar", "--baz" }, opts);
assert.same({ "bar"; "--baz" }, arg);
end);
diff --git a/util/argparse.lua b/util/argparse.lua
index 6d227b5b..9ece050a 100644
--- a/util/argparse.lua
+++ b/util/argparse.lua
@@ -5,7 +5,7 @@ local function parse(arg, config)
local parsed_opts = {};
if #arg == 0 then
- return parsed_opts, arg;
+ return parsed_opts;
end
while true do
local raw_param = arg[1];
@@ -47,7 +47,10 @@ local function parse(arg, config)
end
parsed_opts[param_k] = param_v;
end
- return parsed_opts, arg;
+ for i = 1, #arg do
+ parsed_opts[i] = arg[i];
+ end
+ return parsed_opts;
end
return {