Software /
code /
prosody
Changeset
12475:553c6204fe5b 0.12
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.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 25 Apr 2022 15:09:41 +0100 |
parents | 12474:8fac32810144 |
children | 12476:d8a6e03a7161 12477:cc84682b8429 |
files | util/argparse.lua |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/util/argparse.lua Mon Apr 25 15:07:49 2022 +0100 +++ b/util/argparse.lua Mon Apr 25 15:09:41 2022 +0100 @@ -5,7 +5,7 @@ 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 @@ end parsed_opts[param_k] = param_v; end - return parsed_opts; + return parsed_opts, arg; end return {