diff options
author | Kim Alvefur <zash@zash.se> | 2022-01-05 04:46:27 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2022-01-05 04:46:27 +0100 |
commit | 21740a1382cfd83686051df3cfcaed48e4ef79d5 (patch) | |
tree | 9045d2db4f0d7af6afbf00c6d63fa00f93e5ba6d /spec | |
parent | 9f0a28f1c498a20c51af4686a5ecc9ff1b7c852c (diff) | |
download | prosody-21740a1382cfd83686051df3cfcaed48e4ef79d5.tar.gz prosody-21740a1382cfd83686051df3cfcaed48e4ef79d5.zip |
util.argparse: Add support for repeatable parameters
These are gathered into arrays
Diffstat (limited to 'spec')
-rw-r--r-- | spec/util_argparse_spec.lua | 5 |
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); |