Add default verb support by Artentus · Pull Request #556 · commandlineparser/commandline
I added basic support for a default verb (a verb that will be assumed if no verb is specified).
Tests all completed on my end but I'm not too knowledgable about this code, if there is any problem let me know.
Thanks @Artentus for your work.
I did a quick test:
- for a default verb, it works as expected.
- With more than default verb (not allowed), an Exception "Sequence contains more than one matching element" is fired.
You can validate that only one verb has a default and fire error,e.g, "More than one default verb is not allowed" - Modify the HelpText screen "--help" to show the help with indication of the default verb, e.g
read (Default verb) Reads from source.
write Writes to destination.
- Add test cases to cover the above cases.
The error with more than one default verb is expected. However I do agree a more descriptive error message could be useful.
As for the help text, I'll first have to see how that is actually implemented before I can modify it. Will see what I can do.
As for the help text, I'll first have to see how that is actually implemented before I can modify it. Will see what I can do.
You can concentrate in the error handling and its unit test and push the modification, so I can start review the PR.
Sorry it took me so long, have been busy this week, but everything is merged now.
I see you don't want to allow default verbs with no name. My reasoning behind this was to just have it behave like no verb at all. Functionally it doesn't change anything tho.
Thanks @Artentus for Update.
PR is approved and ready to merge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters