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

"App:allow_extras(true)" calls are ignored when parsing ini files #70

Closed
SkyToGround opened this issue Jan 2, 2018 · 4 comments
Closed

Comments

@SkyToGround
Copy link
Contributor

When calling App:allow_extras(true) to allow for extra (undefined) arguments passed to CLI11, this call is ignored when the extra argument is located in an ini-file.

I am busy with more important things the coming few weeks but I am willing to look into solving this problem when I have the time. Probably early next month.

@henryiii
Copy link
Collaborator

henryiii commented Jan 2, 2018

Okay; I'm not sure why you'd want extra arguments in an ini file, where they should go, and if that should be the same setting as extra arguments on a command line... I'll let you look into it and propose a solution. Please include at least a minimal example of how it would be useful. It might need a dedicated setting, though.

@SkyToGround
Copy link
Contributor Author

The use case is as follows: We have an application that on startup selects and dynamically loads a library based on a command line argument. The specific library selected requires additional settings (arguments) which are provided via command line argument or config file. Thus, before we load the library it is not possible to know which additional command line arguments might be required.

The solution to this problem is to parse the arguments twice. The first time we are only interested in determining which library should be loaded and if --help was used. We ignore all other arguments. In the second pass, we have populated CLI11 with the additional command line options provided in the library and those will now be properly parsed and missing, superfluous or incorrect arguments causes an error.

@SkyToGround SkyToGround mentioned this issue Feb 15, 2018
@SkyToGround
Copy link
Contributor Author

Thanks for the merge!

@leenderthayen
Copy link

leenderthayen commented Sep 25, 2019

Edit: it does work by setting set_config_extras(true). Sorry for the warning, but maybe useful to someone in the future.

Is it possible this is still/again the case? If I run a minimal ini file and set allow_extras(true) on the parent app, I still get 'INI was not able to parse X'

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

3 participants