The Commander
The main class that does all
The Commander
is the main object within ClArgs
. As you have seen in the introduction with a single line of code Commander.ExecuteCommand( args)
Commander will do:
parse the command-line
resolve existing Commands
transform command-line arguments (strings) into typed Options
create a typed Parameters object
run the appropriate Command (based on the provided Verb(s))
do the error-handling
display help messages if requested
The simplest way to use the Commander
is by using its static ExecuteCommand()
method. Alternatively, you may create your own instance new Commander(..
.)
.
Annotations
The Commander
normally relies on Annotations, like[Command]
, [OptionDescriptor]
or [OtionSet]
.
Command Annotation
Classes that implement a Command must have this annotation.
CommandAttribute(string verb, string helpText = null)
Verb - is mandatory and it is used to find the right Command.
HelpText - is optional and it will be displayed whenever help is requested
Last updated