Details
-
Suggestion
-
Resolution: Unresolved
-
P2: Important
-
None
-
None
-
None
Description
When using qcommandlineparser, there is no way to tell that one option is mandatory, one has to do it by hand later on.
It would be more convenient if one could use a flag in the qcommandlineoption to mark it as 'required', so that the parser automatically detects if this was passed as CLI argument and prompts the error message.
So to say, something like:
parser.addOption({"f","file","The input file","", true})
and for backward compatibility this last boolean can be set as false as default value.
Also, it could be nice if one could also specify the expected data type of associated values, e.g. "int", "string" or "double" when defining the QCommandlineoption, so that the returned QVariant gets automatically casted to it and you can retrieve it with an 'auto' variable.
parser.addOption({"f","file","The input file","", true, "QString"})