Table of Contents

Class CommandLineApplication<TModel>

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

Describes a set of command line arguments, options, and execution behavior using a type of TModel to model the application.

public class CommandLineApplication<TModel> : CommandLineApplication, IServiceProvider, IDisposable, IModelAccessor where TModel : class

Type Parameters

TModel
Inheritance
object
CommandLineApplication<TModel>
Implements
Inherited Members
Extension Methods

Constructors

CommandLineApplication()

Initializes a new instance of CommandLineApplication<TModel>.

public CommandLineApplication()

CommandLineApplication(IHelpTextGenerator, IConsole, string)

This constructor is obsolete and will be removed in a future version. The recommended replacement is CommandLineApplication(IHelpTextGenerator, IConsole, string)

Initializes a new instance of CommandLineApplication<TModel>.

public CommandLineApplication(IHelpTextGenerator helpTextGenerator, IConsole console, string workingDirectory)

Parameters

helpTextGenerator IHelpTextGenerator

The help text generator to use.

console IConsole

The console implementation to use.

workingDirectory string

The current working directory.

CommandLineApplication(IConsole)

Initializes a new instance of CommandLineApplication<TModel>.

public CommandLineApplication(IConsole console)

Parameters

console IConsole

The console implementation to use.

CommandLineApplication(IConsole, string)

Initializes a new instance of CommandLineApplication<TModel>.

public CommandLineApplication(IConsole console, string workingDirectory)

Parameters

console IConsole

The console implementation to use.

workingDirectory string

The current working directory.

Properties

Model

An instance of the model associated with the command line application.

public TModel Model { get; }

Property Value

TModel

ModelFactory

Defines the function that produces an instance of TModel.

public Func<TModel> ModelFactory { get; set; }

Property Value

Func<TModel>

Methods

CreateModel()

Create an instance of TModel.

protected virtual TModel CreateModel()

Returns

TModel

An instance of the context.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public override void Dispose()