Command Parameters
Command-Line options
Command-line Options are turned into Parameters. Each Command has its own set of parameters.
app.exe --LocalDateTime='2020-08-01 08:10:00' --LocalTimeZone='Pacific Standard Time'
A good naming convention is, to name the Command class <Verb>Command and the Parameters class <Verb>Parameters as shown in the example above. Anyway, this is not mandatory.
A Verb defines the Command that is executed and Parameters take the Options which were provided in the command-line.
Check out the first example on GitHub 'ConvertToUTC'.
The Commander automatically creates a new instance of the Parameters class that belongs to the Command which will be executed and passed it to the Command's Execute method.
Complex Parameter classes
Parameter classes can inherit form base-classes (see BaseParameters)
and they can contain complex properties which itself are Parameter classes (see OptionSet: Connection
).
This makes the Parameters extremely powerful and flexible, especially if you want to support multiple Verbs/Commands which may share the same options.
Last updated