diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-09-09 14:48:33 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-09-09 14:48:33 -0400 |
| commit | 6ea6aadd963a216e4e321e500515846201d213a5 (patch) | |
| tree | ea85ac24f6dd479cd2f052b63c65dbe3e253b23e /compile.c | |
| parent | 43c595cafe3a09c52a098774671bb55c7e80f128 (diff) | |
Correctly clean up CLI args that are paths
Diffstat (limited to 'compile.c')
| -rw-r--r-- | compile.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -3222,7 +3222,7 @@ CORD compile_cli_arg_call(env_t *env, CORD fn_name, type_t *fn_type) } case TextType: { code = CORD_all(code, "else if (pop_flag(argv, &i, \"", flag, "\", &flag)) {\n", - "$", arg->name, " = flag;\n", + "$", arg->name, " = ", streq(Match(t, TextType)->lang, "Path") ? "Path$cleanup(flag)" : "flag",";\n", arg->name, "$is_set = yes;\n" "}\n"); break; @@ -3304,6 +3304,9 @@ CORD compile_cli_arg_call(env_t *env, CORD fn_name, type_t *fn_type) "if (i < argc) {"); if (t->tag == TextType) { code = CORD_all(code, "$", arg->name, " = Text$from_str(argv[i]);\n"); + if (streq(Match(t, TextType)->lang, "Path")) + code = CORD_all(code, "$", arg->name, " = Path$cleanup($", arg->name, ");\n"); + } else if (t->tag == EnumType) { env_t *enum_env = Match(t, EnumType)->env; for (tag_t *tag = Match(t, EnumType)->tags; tag; tag = tag->next) { |
