CommandLineParser: add special <none> value to disallow empty strings
some mandatory string keys like paths must not be empty. Add the special default value `<none>` so the CommandLineParser can enforce this and generate an according error message for us.
This commit is contained in:
@@ -609,7 +609,7 @@ For example:
|
||||
const String keys =
|
||||
"{help h usage ? | | print this message }"
|
||||
"{@image1 | | image1 for compare }"
|
||||
"{@image2 | | image2 for compare }"
|
||||
"{@image2 |<none>| image2 for compare }"
|
||||
"{@repeat |1 | number }"
|
||||
"{path |. | path to file }"
|
||||
"{fps | -1.0 | fps for output video }"
|
||||
@@ -623,6 +623,9 @@ Note that there are no default values for `help` and `timestamp` so we can check
|
||||
Arguments with default values are considered to be always present. Use the `get()` method in these cases to check their
|
||||
actual value instead.
|
||||
|
||||
String keys like `get<String>("@image1")` return the empty string `""` by default - even with an empty default value.
|
||||
Use the special `<none>` default value to enforce that the returned string must not be empty. (like in `get<String>("@image2")`)
|
||||
|
||||
### Usage
|
||||
|
||||
For the described keys:
|
||||
|
Reference in New Issue
Block a user