Class CommandLineApplication<TModel>
Describes a set of command line arguments, options, and execution behavior
using a type of TModel
to model the application.
Inherited Members
Namespace: McMaster.Extensions.CommandLineUtils
Assembly: McMaster.Extensions.CommandLineUtils.dll
Syntax
public class CommandLineApplication<TModel> : CommandLineApplication, IServiceProvider, IDisposable, IModelAccessor where TModel : class
Type Parameters
Name | Description |
---|---|
TModel |
Constructors
| Improve this Doc View SourceCommandLineApplication(IHelpTextGenerator, IConsole, String, Boolean)
Initializes a new instance of CommandLineApplication.
Declaration
public CommandLineApplication(IHelpTextGenerator helpTextGenerator, IConsole console, string workingDirectory, bool throwOnUnexpectedArg)
Parameters
Type | Name | Description |
---|---|---|
IHelpTextGenerator | helpTextGenerator | The help text generator to use. |
IConsole | console | The console implementation to use. |
System.String | workingDirectory | The current working directory. |
System.Boolean | throwOnUnexpectedArg | Initial value for ThrowOnUnexpectedArgument. |
CommandLineApplication(IConsole)
Initializes a new instance of CommandLineApplication.
Declaration
public CommandLineApplication(IConsole console)
Parameters
Type | Name | Description |
---|---|---|
IConsole | console | The console implementation to use. |
CommandLineApplication(IConsole, String, Boolean)
Initializes a new instance of CommandLineApplication.
Declaration
public CommandLineApplication(IConsole console, string workingDirectory, bool throwOnUnexpectedArg)
Parameters
Type | Name | Description |
---|---|---|
IConsole | console | The console implementation to use. |
System.String | workingDirectory | The current working directory. |
System.Boolean | throwOnUnexpectedArg | Initial value for ThrowOnUnexpectedArgument. |
CommandLineApplication(Boolean)
Initializes a new instance of CommandLineApplication.
Declaration
public CommandLineApplication(bool throwOnUnexpectedArg = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | throwOnUnexpectedArg | Initial value for ThrowOnUnexpectedArgument. |
Properties
| Improve this Doc View SourceModel
An instance of the model associated with the command line application.
Declaration
public TModel Model { get; }
Property Value
Type | Description |
---|---|
TModel |
ModelFactory
Defines the function that produces an instance of TModel
.
Declaration
public Func<TModel> ModelFactory { get; set; }
Property Value
Type | Description |
---|---|
System.Func<TModel> |
Methods
| Improve this Doc View SourceCreateModel()
Create an instance of TModel
.
Declaration
protected virtual TModel CreateModel()
Returns
Type | Description |
---|---|
TModel | An instance of the context. |
Dispose()
Declaration
public override void Dispose()
Overrides
| Improve this Doc View SourceHandleParseResult(ParseResult)
Handle the result of parsing command line arguments.
Declaration
protected override void HandleParseResult(ParseResult parseResult)
Parameters
Type | Name | Description |
---|---|---|
ParseResult | parseResult | The parse result. |
Overrides
Explicit Interface Implementations
| Improve this Doc View SourceIModelAccessor.GetModel()
Declaration
object IModelAccessor.GetModel()
Returns
Type | Description |
---|---|
System.Object |
IModelAccessor.GetModelType()
Declaration
Type IModelAccessor.GetModelType()
Returns
Type | Description |
---|---|
System.Type |