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

Getting a Map as parse result #80

Open
Bendr0id opened this issue Oct 17, 2019 · 1 comment
Open

Getting a Map as parse result #80

Bendr0id opened this issue Oct 17, 2019 · 1 comment

Comments

@Bendr0id
Copy link

Bendr0id commented Oct 17, 2019

Is there a way to get a Map or List<pair> with the parsed values so that you can use it in another class to process the params..?

I can't find it..

@Taywee
Copy link
Owner

Taywee commented Oct 17, 2019

Depends what you want exactly. test.cxx covers most use. If you want a single argument to parse into a map or a list, you can use a custom reader like here. If you want a flag to parse into a list, you can use a ValueFlagList. There are also appropriate Positionals, Map types, and other such things.

If what you want is to just parse the arguments and get the results as a single Map or list of (option, value) pairs, then no, this will not do that directly; it's not built to. You'd have to specify your options and load your structure manually. If you wanted to do something like that, I'd strongly suggest a library that already works by loading up a map, like Boost's program_options. Anything you do to make this library do that would be a hack, and pretty antithetical to the design of this library.

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