Class EntryCommand<TEndpoint>
- Namespace
- TypedRest.CommandLine.Commands
- Assembly
- TypedRest.CommandLine.dll
Command providing an entry point to a hierarchy of named IEndpointCommands.
public class EntryCommand<TEndpoint> : EndpointCommand<TEndpoint>, IEndpointCommand, IEnumerable<KeyValuePair<string, Func<TEndpoint, IEndpointCommand>>>, IEnumerable where TEndpoint : IEndpoint
Type Parameters
TEndpoint
- Inheritance
-
EndpointCommand<TEndpoint>EntryCommand<TEndpoint>
- Implements
- Inherited Members
Constructors
EntryCommand(TEndpoint)
Command providing an entry point to a hierarchy of named IEndpointCommands.
public EntryCommand(TEndpoint endpoint)
Parameters
endpoint
TEndpointThe endpoint this command operates on.
Methods
Add(string, Func<TEndpoint, IEndpointCommand>)
public void Add(string name, Func<TEndpoint, IEndpointCommand> commandProvider)
Parameters
name
stringcommandProvider
Func<TEndpoint, IEndpointCommand>
ExecuteInnerAsync(IReadOnlyList<string>, CancellationToken)
Parses command-line arguments and executes the resulting operation when no additional sub-IEndpointCommand is specified.
protected override Task ExecuteInnerAsync(IReadOnlyList<string> args, CancellationToken cancellationToken = default)
Parameters
args
IReadOnlyList<string>the console arguments.
cancellationToken
CancellationTokenUsed to cancel the request.
Returns
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<KeyValuePair<string, Func<TEndpoint, IEndpointCommand>>> GetEnumerator()
Returns
- IEnumerator<KeyValuePair<string, Func<TEndpoint, IEndpointCommand>>>
An enumerator that can be used to iterate through the collection.
GetSubCommand(string)
Creates a sub-IEndpointCommand based on the given name
.
protected override IEndpointCommand? GetSubCommand(string name)
Parameters
name
string
Returns
- IEndpointCommand
The IEndpointCommand or
null
if thename
does not match.