Comparison

util/argparse.lua @ 13058:766152afc1c9

util.argparse: Translate '-' to '_' in long option names for convenience A review of existing code suggests nothing will break. So, here we go...
author Matthew Wild <mwild1@gmail.com>
date Fri, 07 Apr 2023 13:24:29 +0100
parent 12477:cc84682b8429
child 13160:4ee9a912ceea
comparison
equal deleted inserted replaced
13056:c38b1c63aa5c 13058:766152afc1c9
42 param_k, param_v = param:sub(4), false; 42 param_k, param_v = param:sub(4), false;
43 else 43 else
44 param_k, param_v = param, true; 44 param_k, param_v = param, true;
45 end 45 end
46 end 46 end
47 param_k = param_k:gsub("%-", "_");
47 end 48 end
48 parsed_opts[param_k] = param_v; 49 parsed_opts[param_k] = param_v;
49 end 50 end
50 for i = 1, #arg do 51 for i = 1, #arg do
51 parsed_opts[i] = arg[i]; 52 parsed_opts[i] = arg[i];