aboutsummaryrefslogtreecommitdiffstats
path: root/spec/util_argparse_spec.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-01-05 04:46:27 +0100
committerKim Alvefur <zash@zash.se>2022-01-05 04:46:27 +0100
commit21740a1382cfd83686051df3cfcaed48e4ef79d5 (patch)
tree9045d2db4f0d7af6afbf00c6d63fa00f93e5ba6d /spec/util_argparse_spec.lua
parent9f0a28f1c498a20c51af4686a5ecc9ff1b7c852c (diff)
downloadprosody-21740a1382cfd83686051df3cfcaed48e4ef79d5.tar.gz
prosody-21740a1382cfd83686051df3cfcaed48e4ef79d5.zip
util.argparse: Add support for repeatable parameters
These are gathered into arrays
Diffstat (limited to 'spec/util_argparse_spec.lua')
-rw-r--r--spec/util_argparse_spec.lua5
1 files changed, 5 insertions, 0 deletions
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);