Skip to content

Need help with options that may or may not have a parameter value #1951

Answered by remkop
sean-neeley asked this question in Q&A
Discussion options

You must be logged in to vote

This is a common problem for options that have an optional value.
Please see this documentation on Optional Parameter Limitations in the user manual.

Your best solution may be to use the example IParameterPreprocessor from the user manual in your application.
That preprocessor implementation customizes the parser, such that VALUE in --option=VALUE is interpreted as the option parameter, and in --option VALUE (without the = separator), VALUE is interpreted as the positional parameter.
I believe this is exactly what you are looking for.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by remkop
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants