Software / code / prosody
Diff
spec/util_argparse_spec.lua @ 13160:4ee9a912ceea
util.argparse: Add support for repeatable parameters
These are gathered into arrays
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 05 Jan 2022 04:46:27 +0100 |
| parent | 12477:cc84682b8429 |
| child | 13733:48c056c10e5a |
line wrap: on
line diff
--- a/spec/util_argparse_spec.lua Sat Jun 17 13:37:33 2023 +0200 +++ b/spec/util_argparse_spec.lua Wed Jan 05 04:46:27 2022 +0100 @@ -50,4 +50,9 @@ 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);