Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple values option #3

Open
TheWaWaR opened this issue Jul 24, 2024 · 2 comments
Open

Support multiple values option #3

TheWaWaR opened this issue Jul 24, 2024 · 2 comments

Comments

@TheWaWaR
Copy link

Is there any plan to support option with multiple values? Just like currently multiple position argument does.

It may looks something like this:

const Options = struct {
    values: std.ArrayList([]const u8),
}
@n0s4
Copy link
Owner

n0s4 commented Jul 29, 2024

Its a bit tricky because I do not want to necessitate passing an allocator, and an ArrayList does need an allocator. I would need to be able to check at comptime whether an ArrayList type is allowed based on whether an Allocator will be passed at runtime.

However, an array would definitely be possible and you can already collect any number of trailing arguments.

Also, do you mind sharing your use case?

@n0s4
Copy link
Owner

n0s4 commented Jul 29, 2024

That said, allocating does unlock a lot of nice possibilities, perhaps a fully separate parseWithAllocator which implements such things would be a good idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants