Software /
code /
prosody
Diff
util/argparse.lua @ 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 |
parent | 11846:6425dfa3de45 |
child | 12477:cc84682b8429 |
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 {