Class CliHostedService
The pi-cli
hosted service to manage the application lifetime and terminal customization.
Implements
Inherited Members
Namespace: PerpetualIntelligence.Cli.Integration
Assembly: PerpetualIntelligence.Cli.dll
Syntax
public class CliHostedService : IHostedService
Constructors
| Improve this Doc View SourceCliHostedService(IServiceProvider, CliOptions, ILogger<CliHostedService>)
Initializes a new instance.
Declaration
public CliHostedService(IServiceProvider serviceProvider, CliOptions cliOptions, ILogger<CliHostedService> logger)
Parameters
Type | Name | Description |
---|---|---|
IServiceProvider | serviceProvider | The service provider. |
CliOptions | cliOptions | The configuration options. |
ILogger<CliHostedService> | logger | The logger. |
Methods
| Improve this Doc View SourceCheckHostApplicationConfigurationAsync(CliOptions)
Allows the host application to perform additional configuration option checks.
Declaration
protected virtual Task CheckHostApplicationConfigurationAsync(CliOptions options)
Parameters
Type | Name | Description |
---|---|---|
CliOptions | options |
Returns
Type | Description |
---|---|
Task |
OnStarted()
Triggered when the pi-cli
application host has fully started.
Declaration
protected virtual void OnStarted()
OnStopped()
Triggered when the pi-cli
application host has completed a graceful shutdown. The application will
not exit until all callbacks registered on this token have completed.
Declaration
protected virtual void OnStopped()
OnStopping()
Triggered when the pi-cli
application host is starting a graceful shutdown. Shutdown will block until
all callbacks registered on this token have completed.
Declaration
protected virtual void OnStopping()
PrintHostApplicationHeaderAsync()
Allows the host application to print the custom header.
Declaration
protected virtual Task PrintHostApplicationHeaderAsync()
Returns
Type | Description |
---|---|
Task |
PrintHostApplicationLicensingAsync(License)
Allows host application to print custom licensing information.
Declaration
protected virtual Task PrintHostApplicationLicensingAsync(License license)
Parameters
Type | Name | Description |
---|---|---|
License | license |
Returns
Type | Description |
---|---|
Task |
RegisterHostApplicationEventsAsync(IHostApplicationLifetime)
Allows the application to register its custom IHostApplicationLifetime events.
Declaration
protected virtual Task RegisterHostApplicationEventsAsync(IHostApplicationLifetime hostApplicationLifetime)
Parameters
Type | Name | Description |
---|---|---|
IHostApplicationLifetime | hostApplicationLifetime |
Returns
Type | Description |
---|---|
Task |
StartAsync(CancellationToken)
Starts the pi-cli
hosted service asynchronously.
Declaration
public async Task StartAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task |
StopAsync(CancellationToken)
Stops the pi-cli
hosted service asynchronously.
Declaration
public Task StopAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task |