Class DefaultCommandShell
A default command shell.
Inherited Members
Namespace: Kephas.Application.Console
Assembly: Kephas.Application.Console.dll
Syntax
[OverridePriority(Priority.Lowest)]
public class DefaultCommandShell : Loggable, ILoggable, ICommandShell
Constructors
| Improve this Doc View SourceDefaultCommandShell(ICommandProcessor, ISerializationService, IContextFactory)
Initializes a new instance of the DefaultCommandShell class.
Declaration
public DefaultCommandShell(ICommandProcessor commandProcessor, ISerializationService serializationService, IContextFactory contextFactory)
Parameters
Type | Name | Description |
---|---|---|
ICommandProcessor | commandProcessor | The command processor. |
ISerializationService | serializationService | The serialization service. |
IContextFactory | contextFactory | The context factory. |
DefaultCommandShell(IConsole, ICommandProcessor, ISerializationService, IContextFactory)
Initializes a new instance of the DefaultCommandShell class.
Declaration
public DefaultCommandShell(IConsole console, ICommandProcessor commandProcessor, ISerializationService serializationService, IContextFactory contextFactory)
Parameters
Type | Name | Description |
---|---|---|
IConsole | console | The console. |
ICommandProcessor | commandProcessor | The command processor. |
ISerializationService | serializationService | The serialization service. |
IContextFactory | contextFactory | The context factory. |
Properties
| Improve this Doc View SourceConsole
Gets the console.
Declaration
public IConsole Console { get; }
Property Value
Type | Description |
---|---|
IConsole | The console. |
Methods
| Improve this Doc View SourceParseCommandLine(String)
Parses the command line.
Declaration
protected virtual (string command, IExpando args)ParseCommandLine(string commandLine)
Parameters
Type | Name | Description |
---|---|---|
System.String | commandLine | The command line. |
Returns
Type | Description |
---|---|
System.ValueTuple<System.String, IExpando> | A Tuple consisting of the command and the command arguments. |
ReadCommandLineAsync(CancellationToken)
Reads the command line asynchronously.
Declaration
protected virtual Task<string> ReadCommandLineAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken | A token that allows processing to be cancelled. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.String> | An asynchronous result that yields the read command. |
StartAsync(CancellationToken)
Starts processing commands asynchronously.
Declaration
public virtual Task StartAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken | A token that allows processing to be cancelled. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | An asynchronous result. |
WriteCommandOutputAsync(Object, CancellationToken)
Writes a command output asynchronous.
Declaration
protected virtual Task WriteCommandOutputAsync(object result, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Object | result | The result. |
System.Threading.CancellationToken | cancellationToken | A token that allows processing to be cancelled. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | An asynchronous result. |
WritePrompt()
Writes the prompt.
Declaration
protected virtual void WritePrompt()
WriteWelcomeScreen()
Writes the welcome screen.
Declaration
protected virtual void WriteWelcomeScreen()