From 21740a1382cfd83686051df3cfcaed48e4ef79d5 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 5 Jan 2022 04:46:27 +0100 Subject: util.argparse: Add support for repeatable parameters These are gathered into arrays --- spec/util_argparse_spec.lua | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'spec') diff --git a/spec/util_argparse_spec.lua b/spec/util_argparse_spec.lua index 0f2430b7..40f647c9 100644 --- a/spec/util_argparse_spec.lua +++ b/spec/util_argparse_spec.lua @@ -50,4 +50,9 @@ describe("parse", function() assert.equal("-h", where, "returned where"); end); + it("supports array arguments", function () + local opts, err = parse({ "--item"; "foo"; "--item"; "bar" }, { array_params = { item = true } }); + assert.falsy(err); + assert.same({"foo","bar"}, opts.item); + end) end); -- cgit v1.2.3