interface ServiceProvider

Interface allowing services to be provided to the CLI.

Properties

readonly
serviceId: string

The ID which identifies the service provided.

readonly
servicePriority: number

Used to determine the order in which multiple service instances will be initialised. Higher values will be initialised before lower values.

Methods

provide(cliConfig: CLIConfig): Promise<ServiceInfo>

Return ServiceInfo containing the service and any commands which should be registered in the CLI.

initService(context: Context): Promise<void>

Initialise the service. This will be invoked AFTER any GlobalModifierCommand provided in the ServiceInfo have been invoked (if specified as CLI arguments or CLI configuration).

NOTE: Other services within the provided context will only have been initialised if they have a higher servicePriority value than the current service.

Usage

import { type ServiceProvider } from ".";