Using the accepted answer in Best way to parse command line arguments in C#? as your example, how can I make the 'r' or 'repeat' option only OPTIONALLY take a value and not REQUIRE it, and how can I set a default value if the value is not provided? Thanks!
Apparently you can do something like:
{ "r|repeat:",
"the number of {TIMES} to repeat the greeting.\n" +
"this must be an integer.",
(int v) => repeat = v ?? 1 },
Where the default value is 1 if the value is not provided.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With