aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2022-04-25 15:09:41 +0100
committerMatthew Wild <mwild1@gmail.com>2022-04-25 15:09:41 +0100
commit0eef6dde1e3193ec86f949acc114e91c36c5f365 (patch)
tree972c44dc9a35f08500eb9dabb406623804601c51
parentf86d1517ce1c6ad3eeebcfb9f57d3689f6f9e943 (diff)
downloadprosody-0eef6dde1e3193ec86f949acc114e91c36c5f365.tar.gz
prosody-0eef6dde1e3193ec86f949acc114e91c36c5f365.zip
util.argparse: Return final 'arg' table with positional arguments for convenience
This is the same as the input table (which is mutated during processing), but if that table was created on the fly, such as by packing `...` it's convenient if it also gets returned from the parse function.
-rw-r--r--util/argparse.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/util/argparse.lua b/util/argparse.lua
index c08a857c..6d227b5b 100644
--- a/util/argparse.lua
+++ b/util/argparse.lua
@@ -5,7 +5,7 @@ local function parse(arg, config)
local parsed_opts = {};
if #arg == 0 then
- return parsed_opts;
+ return parsed_opts, arg;
end
while true do
local raw_param = arg[1];
@@ -47,7 +47,7 @@ local function parse(arg, config)
end
parsed_opts[param_k] = param_v;
end
- return parsed_opts;
+ return parsed_opts, arg;
end
return {