diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-09-04 15:30:38 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-09-04 15:30:38 -0400 |
| commit | 973b1c55c209a8f91e8cfacb3ab4a053ef82939e (patch) | |
| tree | 1ea990269e528776b97d277cec26e8a0826f191b | |
| parent | e9796e14334dc43147cb3e24f7f98697d3a0f164 (diff) | |
Fix array CLI arguments
| -rw-r--r-- | compile.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -3073,7 +3073,7 @@ CORD compile_cli_arg_call(env_t *env, CORD fn_name, type_t *fn_type) if (Match(t, ArrayType)->item_type->tag != TextType) compiler_err(NULL, NULL, NULL, "Main function has unsupported argument type: %T (only arrays of Text are supported)", t); code = CORD_all(code, "else if (pop_flag(argv, &i, \"", flag, "\", &flag)) {\n", - "$", arg->name, " = Text$split(flag, \",\");\n", + "$", arg->name, " = Text$split(flag, Pattern(\",\"));\n", arg->name, "$is_set = yes;\n" "}\n"); break; @@ -3125,7 +3125,7 @@ CORD compile_cli_arg_call(env_t *env, CORD fn_name, type_t *fn_type) "for (; i < argc; i++) {\n" "if (argv[i]) {\n" "Text_t arg = Text$from_str(argv[i]);\n" - "Array$insert(&$", arg->name, ", &arg, 0, $ArrayInfo(&$Text));\n" + "Array$insert(&$", arg->name, ", &arg, I(0), sizeof(Text_t));\n" "argv[i] = NULL;\n" "}\n" "}\n", |
