Changeset

12478:82270a6b1234

Merge 0.12->trunk
author Matthew Wild <mwild1@gmail.com>
date Mon, 25 Apr 2022 16:35:10 +0100
parents 12476:d8a6e03a7161 (current diff) 12477:cc84682b8429 (diff)
children 12480:7e9ebdc75ce4
files
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/spec/util_argparse_spec.lua	Mon Apr 25 15:09:53 2022 +0100
+++ b/spec/util_argparse_spec.lua	Mon Apr 25 16:35:10 2022 +0100
@@ -20,7 +20,7 @@
 		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);
 
--- a/util/argparse.lua	Mon Apr 25 15:09:53 2022 +0100
+++ b/util/argparse.lua	Mon Apr 25 16:35:10 2022 +0100
@@ -5,7 +5,7 @@
 	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 @@
 		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 {