diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-11-22 16:56:57 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-11-22 16:56:57 -0500 |
| commit | 0aeacfbd83b0afe8a8ea654bc1554b8d7d29e9b1 (patch) | |
| tree | 28666091682a978680ccc5bf14819ddfcfbbe9b5 /src/stdlib/cli.c | |
| parent | e0706bc707ea6a8be86cee9fde21971cde3d7a42 (diff) | |
CLI arg parsing fixes for optional types
Diffstat (limited to 'src/stdlib/cli.c')
| -rw-r--r-- | src/stdlib/cli.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/stdlib/cli.c b/src/stdlib/cli.c index 3523296a..08260171 100644 --- a/src/stdlib/cli.c +++ b/src/stdlib/cli.c @@ -215,12 +215,14 @@ static List_t parse_arg_list(List_t args, const char *flag, void *dest, const Ty return List$from(args, I(2)); } else { args = parse_arg_list(args, flag, dest, nonnull, allow_dashes); - if (nonnull == &Int64$info) ((OptionalInt64_t *)dest)->has_value = true; + if (nonnull == &Int$info || nonnull == &Path$info || nonnull == &Num$info || nonnull == &Num32$info + || nonnull->tag == TextInfo) + return args; + else if (nonnull == &Int64$info) ((OptionalInt64_t *)dest)->has_value = true; else if (nonnull == &Int32$info) ((OptionalInt32_t *)dest)->has_value = true; else if (nonnull == &Int16$info) ((OptionalInt16_t *)dest)->has_value = true; else if (nonnull == &Int8$info) ((OptionalInt8_t *)dest)->has_value = true; else if (nonnull == &Byte$info) ((OptionalByte_t *)dest)->has_value = true; - else if (nonnull == &Path$info) return args; else if (nonnull->tag == StructInfo && nonnull != &Path$info) *(bool *)(dest + nonnull->size) = true; else print_err("Unsupported type: ", generic_as_text(NULL, true, nonnull)); return args; |
