From 3779e7ccca177f8b9c3ccc4260f26f06fe7e8587 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 18 Oct 2025 18:20:20 -0400 Subject: Support passing pointers to CLI args --- src/stdlib/cli.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/stdlib/cli.c') diff --git a/src/stdlib/cli.c b/src/stdlib/cli.c index 8512d106..a82be076 100644 --- a/src/stdlib/cli.c +++ b/src/stdlib/cli.c @@ -248,6 +248,12 @@ static int64_t parse_arg_list(List_t args, const char *flag, void *dest, const T OptionalNum32_t parsed = Num32$parse(Text$from_str(arg), NULL); if (isnan(parsed)) print_err("Could not parse argument for --", flag, ": ", arg); *(Num32_t *)dest = parsed; + } else if (type->tag == PointerInfo) { + // For pointers, we can just allocate memory for the value and then parse the value + void *value = GC_MALLOC((size_t)type->PointerInfo.pointed->size); + n = parse_arg_list(args, flag, value, type->PointerInfo.pointed, allow_dashes); + *(void **)dest = value; + return n; } else if (type == &Path$info) { *(Path_t *)dest = Path$from_str(arg); } else if (type->tag == TextInfo) { -- cgit v1.2.3