diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-10-18 14:29:42 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-10-18 14:29:42 -0400 |
| commit | 6d4af711c1d18885c94d73110d787c503ebac076 (patch) | |
| tree | 0f0e0fc60915d2c26ec97eca985fe1e418e6c4a9 /src/compile/cli.c | |
| parent | 5a26b365fc732c0873474371880b43fc9e843e4b (diff) | |
Overhaul of CLI arg parsing logic
Diffstat (limited to 'src/compile/cli.c')
| -rw-r--r-- | src/compile/cli.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/compile/cli.c b/src/compile/cli.c index 4138b778..eec2f941 100644 --- a/src/compile/cli.c +++ b/src/compile/cli.c @@ -106,13 +106,10 @@ Text_t compile_cli_arg_call(env_t *env, Text_t fn_name, type_t *fn_type, const c code = Texts(code, "tomo_parse_args(argc, argv, ", usage_code, ", ", help_code, ", ", version_code); for (arg_t *arg = fn_info->args; arg; arg = arg->next) { code = Texts(code, ",\n{", quoted_text(Text$replace(Text$from_str(arg->name), Text("_"), Text("-"))), ", ", - arg->default_val ? "false" : "true", ", ", compile_type_info(arg->type), ", &", + arg->alias ? Texts(quoted_text(Text$from_str(arg->name)), "[0]") // TODO: escape char properly + : Text("'\\0'"), + ", ", arg->default_val ? "false" : "true", ", ", compile_type_info(arg->type), ", &", Texts("_$", Text$from_str(arg->name)), "}"); - if (arg->alias) { - code = Texts(code, ",\n{", quoted_text(Text$replace(Text$from_str(arg->alias), Text("_"), Text("-"))), ", ", - arg->default_val ? "false" : "true", ", ", compile_type_info(arg->type), ", &", - Texts("_$", Text$from_str(arg->name)), "}"); - } } code = Texts(code, ");\n"); |
