Namespace McMaster.Extensions.CommandLineUtils.Conventions
Classes
AppNameFromEntryAssemblyConvention
Sets Name using the name of the entry assembly to the current application. It is only applied if the name is null.
ArgumentAttributeConvention
Adds a CommandArgument for each ArgumentAttribute on the model type for CommandLineApplication<TModel>.
AttributeConvention
Searches the model type and its members for attributes that implement IMemberConvention or IConvention.
CommandAttributeConvention
Adds settings from CommandAttribute and System.ComponentModel.DataAnnotations.ValidationAttribute set on the model type for CommandLineApplication<TModel>.
CommandNameFromTypeConvention
Sets the command name based on the model type, if is not otherwise set.
This attempts to infer a command name using a few rules, such as using kebab-case
and trimming "Command" from the name of the type.
ConstructorInjectionConvention
Uses an instance of System.IServiceProvider to call constructors when creating models.
ConventionContext
The context in which a convention is applied.
DefaultHelpOptionConvention
Adds a help option of --help if no other help option is specified.
ExecuteMethodConvention
Sets a command handler to call a method named
OnExecute
or OnExecuteAsync
on the model type
of CommandLineApplication<TModel>.
HelpOptionAttributeConvention
Sets OptionHelp based on the usage of HelpOptionAttribute.
OptionAttributeConvention
Adds an CommandOption to match each usage of OptionAttribute on the model type of CommandLineApplication<TModel>.
OptionAttributeConventionBase<TAttribute>
Shared implementation for adding conventions based on OptionAttributeBase.
ParentPropertyConvention
Sets a property named Parent
on the model type to the value
of the model of the parent command.
RemainingArgsPropertyConvention
Sets a property named RemainingArguments
or RemainingArgs
on the model type on CommandLineApplication<TModel>
to the value of RemainingArguments.
SubcommandAttributeConvention
Creates a subcommand for each SubcommandAttribute on the model type of CommandLineApplication<TModel>.
SubcommandPropertyConvention
Sets a property named Subcommand
to the value of the selected subcommand
model type of CommandLineApplication<TModel>.
ValidationErrorMethodConvention
Invokes a method named OnValidationError
on the model type of CommandLineApplication<TModel>
to handle validation errors.
VersionOptionAttributeConvention
Sets OptionVersion using settings from VersionOptionAttribute on the model type of CommandLineApplication<TModel>.
VersionOptionFromMemberAttributeConvention
Sets OptionVersion using settings from VersionOptionFromMemberAttribute on the model type of CommandLineApplication<TModel>.
Interfaces
IConvention
Defines a convention for an instance of CommandLineApplication<TModel>.
IConventionBuilder
Builds a collection of conventions.
IMemberConvention
Defines a convention that is implemented as an attribute on a model type.