Table of Contents

Interface ICommandMetadataProvider

Namespace
McMaster.Extensions.CommandLineUtils.SourceGeneration
Assembly
McMaster.Extensions.CommandLineUtils.dll

Provides metadata about a command model type. Implemented by both reflection-based and source-generated providers.

public interface ICommandMetadataProvider

Properties

Arguments

Gets metadata for all arguments defined on the model.

IReadOnlyList<ArgumentMetadata> Arguments { get; }

Property Value

IReadOnlyList<ArgumentMetadata>

CommandInfo

Gets metadata about the command itself (name, description, etc.).

CommandMetadata? CommandInfo { get; }

Property Value

CommandMetadata

ExecuteHandler

Gets the execute handler if one is defined (OnExecute/OnExecuteAsync).

IExecuteHandler? ExecuteHandler { get; }

Property Value

IExecuteHandler

HelpOption

Gets help option metadata if defined.

HelpOptionMetadata? HelpOption { get; }

Property Value

HelpOptionMetadata

ModelType

Gets the model type this provider handles.

Type ModelType { get; }

Property Value

Type

Options

Gets metadata for all options defined on the model.

IReadOnlyList<OptionMetadata> Options { get; }

Property Value

IReadOnlyList<OptionMetadata>

SpecialProperties

Gets property accessors for setting Parent, RemainingArgs, Subcommand.

SpecialPropertiesMetadata? SpecialProperties { get; }

Property Value

SpecialPropertiesMetadata

Subcommands

Gets metadata for subcommand types.

IReadOnlyList<SubcommandMetadata> Subcommands { get; }

Property Value

IReadOnlyList<SubcommandMetadata>

ValidateHandler

Gets the validate handler if one is defined (OnValidate).

IValidateHandler? ValidateHandler { get; }

Property Value

IValidateHandler

ValidationErrorHandler

Gets the validation error handler if one is defined (OnValidationError).

IValidationErrorHandler? ValidationErrorHandler { get; }

Property Value

IValidationErrorHandler

VersionOption

Gets version option metadata if defined.

VersionOptionMetadata? VersionOption { get; }

Property Value

VersionOptionMetadata

Methods

GetModelFactory(IServiceProvider?)

Creates a model factory for the type.

IModelFactory GetModelFactory(IServiceProvider? services)

Parameters

services IServiceProvider

Optional service provider for dependency injection.

Returns

IModelFactory

A factory that can create model instances.