CliCommandBuilder Class

Represents a command builder generated by the source generator.

Definition

Namespace: DotMake.CommandLine
Assembly: DotMake.CommandLine (in DotMake.CommandLine.dll) Version: 1.8.8
C#
public abstract class CliCommandBuilder
Inheritance
Object    CliCommandBuilder

Constructors

CliCommandBuilder Initializes a new instance of the CliCommandBuilder class.

Properties

Children Gets the command builders that are nested/external children of this command builder.
DefinitionType The definition class that this command builder is generated for.
NameCasingConvention Gets the character casing convention used for automatically generated command, option and argument names.
NamePrefixConvention Gets the prefix convention used for automatically generated option names.
ParentDefinitionType The parent definition class if this command builder is generated for a nested/external child.
ShortFormAutoGenerate Gets a value which indicates whether short form aliases were automatically generated for options.
ShortFormPrefixConvention Gets the prefix convention used for automatically generated short form option aliases.

Methods

Bind Creates a new instance of the command definition class and binds/populates the properties from the parse result. Note that binding will be done only once, so calling this method consecutively will return the cached result.

If the command line input is not for this definition class (e.g. it's for a sub-command but not for this root command or vice versa), then the returned instance would be empty (i.e. properties would have default values).

Build Builds a CliCommand instance, populated with sub-commands, options, arguments and settings.
Get(Type) Gets the command builder registered for the definition class.
GetTDefinition Gets the command builder registered for the definition class.
GetArgumentParserTArgument(FuncString, TArgument) Gets an argument parser method for an argument type.

This is mainly used for adding support for binding custom types which have a public constructor or a static Parse method with a string parameter (other parameters, if any, should be optional).

GetArgumentParserTCollection, TItem(FuncArray, TCollection, FuncString, TItem) Gets an argument parser method for an argument type, if it's a collection type.

This is mainly used for adding support for all IEnumerableT compatible types which have a public constructor with a IEnumerableT or IListT parameter (other parameters, if any, should be optional).

GetChildren(Type) Gets the command builders that are registered as nested/external children of a parent definition.
GetChildrenTParentDefinition Gets the command builders that are registered as nested/external children of a parent definition.
GetValueForArgument(ParseResult, CliArgument) Gets the parsed or default value for the specified argument.

Extended version for DotMake CLI which can bind custom classes, does not fall back to internal ArgumentConverter.GetDefaultValue which does not support all IList compatible types.

GetValueForArgumentT(ParseResult, CliArgumentT) Gets the parsed or default value for the specified argument.

Extended version for DotMake CLI which can bind custom classes, does not fall back to internal ArgumentConverter.GetDefaultValue which does not support all IList compatible types.

GetValueForOption(ParseResult, CliOption) Gets the parsed or default value for the specified option.

Extended version for DotMake CLI which can bind custom classes, does not fall back to internal ArgumentConverter.GetDefaultValue which does not support all IList compatible types.

GetValueForOptionT(ParseResult, CliOptionT) Gets the parsed or default value for the specified option.

Extended version for DotMake CLI which can bind custom classes, does not fall back to internal ArgumentConverter.GetDefaultValue which does not support all IList compatible types.

Register Registers this command builder so that it can be found by the definition class, and it can be found by the parent definition class if it's a nested/external child.
Register(Type, CliCommandBuilder) Registers a command builder so that it can be found by the definition class.
RegisterTDefinition(CliCommandBuilder) Registers a command builder so that it can be found by the definition class.
RegisterAsChild(Type, CliCommandBuilder) Registers a command builder as a nested/external child so that it can be found by the parent definition class.
RegisterAsChildTParentDefinition(CliCommandBuilder) Registers a command builder as a nested/external child so that it can be found by the parent definition class.

Fields

Binder A delegate which is set by the source generator to be called from Bind(ParseResult) method.

See Also