import { PackageJson } from "type-fest"; import { ActionFactory } from "../action-factory"; import { ComponentFactory } from "../component-factory"; import { Application, InputValue } from "../contracts"; import { Input } from "../input"; import { InputDefinition } from "../input/definition"; import { Output } from "../output"; import { Config, Environment } from "../services"; /** * @export * @abstract * @class Command */ export declare abstract class Command { /** * @private * @type {Application} * @memberof Command */ protected readonly app: Application; /** * @private * @type {Environment} * @memberof Command */ protected readonly env: Environment; /** * @private * @type {Output} * @memberof Command */ protected readonly output: Output; /** * @private * @type {Contracts.Config} * @memberof Command */ protected readonly config: Config; /** * @private * @type {Application} * @memberof Command */ protected readonly pkg: PackageJson; /** * @private * @type {Application} * @memberof Command */ protected readonly actions: ActionFactory; /** * @private * @type {Application} * @memberof Command */ protected readonly components: ComponentFactory; /** * The console command signature. * * @type {string} * @memberof Command */ signature: string; /** * The console command description. * * @type {(string | undefined)} * @memberof Command */ description: string | undefined; /** * Indicates whether the command should be shown in the command list. * * @type {boolean} * @memberof Command */ isHidden: boolean; /** * Indicates whether the command requires a network to be present. * * @type {boolean} * @memberof Command */ requiresNetwork: boolean; /** * @type {InputDefinition} * @memberof Command */ protected definition: InputDefinition; /** * @type {Input} * @memberof Command */ protected input: Input; /** * Configure the console command. * * @remarks * This is executed before arguments are available in any way, shape or form. * If your task requires arguments to be parsed and validated you should consider to use the initialize method. * * @returns {void} * @memberof Command */ configure(): void; /** * @memberof Command */ register(argv: string[]): void; /** * Initialize the command after the input has been bound and before the input is validated. * * @returns {Promise} * @memberof Command */ initialize(): Promise; /** * Interact with the user. * * @returns {Promise} * @memberof Command */ interact(): Promise; /** * Runs the command. * * @returns {Promise} * @memberof Command */ run(): Promise; /** * @memberof Command */ showHelp(): void; /** * @returns {Record} * @memberof Command */ getArguments(): Record; /** * @template T * @param {string} name * @returns {T} * @memberof Command */ getArgument(name: string): any; /** * @param {string} name * @param {InputValue} value * @memberof Input */ setArgument(name: string, value: InputValue): void; /** * @param {string} name * @returns {boolean} * @memberof Command */ hasArgument(name: string): boolean; /** * @returns {Record} * @memberof Command */ getFlags(): Record; /** * @template T * @param {string} name * @returns {T} * @memberof Command */ getFlag(name: string): any; /** * @param {string} name * @param {InputValue} value * @memberof Input */ setFlag(name: string, value: InputValue): void; /** * @param {string} name * @returns {boolean} * @memberof Command */ hasFlag(name: string): boolean; private detectConfig; /** * @private * @returns {Promise} * @memberof Command */ private detectNetwork; /** * @abstract * @returns {Promise} * @memberof Command */ abstract execute(): Promise; } //# sourceMappingURL=command.d.ts.map