Skip to content

Configuring parameters

JF Blouin edited this page May 7, 2019 · 12 revisions

A command is executed with parameters, which map to the parameters of the functions. Since code parameters can have default values, command parameters are printed in help as parameters when required and options when optional (or having default values).


The Parameter attribute

All method parameters are automatically mapped to either parameters or options depending on if a default value is specified in the code and the method name is used. However, it is possible to decorate a parameter the Parameter attribute, located in the CommandLineEngine.Attributes namespace to override values. This attribute accepts the following values, all of which are optional:

Property Use
Name Allows you to override the name of the parameter, by default, uses the parameter name. Passed as --name value.
ShortName Allows you to specify a a short name for the parameter. Passed as -shortName value.
Description Allows you to specify a description for the parameter, will be shown in help.

A command will be executable using MyApp.exe commandName --name nameValue -shortName shortNameValue