import { Command } from '@oclif/core'; import { Logger, Org, SfdxConfigAggregator, SfError, SfProject } from '@salesforce/core'; import { AnyJson, JsonMap, Optional } from '@salesforce/ts-types'; import { OutputArgs, OutputFlags } from '@oclif/core/lib/interfaces'; import { flags as Flags, FlagsConfig } from './sfdxFlags'; import { Deprecation, TableColumns, UX } from './ux'; export interface SfdxResult { data?: AnyJson; tableColumnData?: TableColumns; display?: (this: Result) => void; } /** * A class that handles command results and formatting. Use this class * to override command display behavior or to get complex table formatting. * For simple table formatting, use {@link SfdxCommand.tableColumnData} to * define a string array of keys to use as table columns. */ export declare class Result implements SfdxResult { data: AnyJson; tableColumnData?: TableColumns; ux: UX; constructor(config?: SfdxResult); display(): void; } /** * Defines a varargs configuration. If set to true, there will be no * validation and varargs will not be required. The validator function * should throw an error if validation fails. */ export declare type VarargsConfig = { required: boolean; validator?: (name: string, value: string) => void; } | boolean; /** * A base command that provides convenient access to common SFDX flags, a logger, * CLI output formatting, scratch orgs, and devhubs. Extend this command and set * various static properties and a flag configuration to add SFDX behavior. * * @extends @oclif/command * @see https://github.com/oclif/command */ export declare abstract class SfdxCommand extends Command { protected get statics(): typeof SfdxCommand; protected static supportsUsername: boolean; protected static requiresUsername: boolean; protected static supportsDevhubUsername: boolean; protected static requiresDevhubUsername: boolean; protected static requiresProject: boolean; protected static deprecated?: Deprecation; protected static tableColumnData: string[]; protected static flagsConfig: FlagsConfig; protected static result: SfdxResult; protected static varargs: VarargsConfig; protected logger: Logger; protected ux: UX; protected configAggregator: SfdxConfigAggregator; protected org?: Org; protected hubOrg?: Org; protected project?: SfProject; protected result: Result; protected flags: OutputFlags; protected args: OutputArgs; protected varargs?: JsonMap; /** event names to be registered for command specific hooks */ protected readonly lifecycleEventNames: string[]; private isJson; static getVarArgsConfig(): Partial | undefined; _run(): Promise>; protected assignProject(): Promise; protected assignOrg(): Promise; protected assignHubOrg(): Promise; protected shouldEmitHelp(): boolean; protected init(): Promise; protected catch(err: any): Promise; protected finally(err: Optional): Promise; protected warnIfDeprecated(): void; protected getJsonResultObject(result?: AnyJson, status?: number): { status: number; result: AnyJson; }; protected parseVarargs(args?: string[]): JsonMap; /** * Format errors and actions for human consumption. Adds 'ERROR running ', * and outputs all errors in red. When there are actions, we add 'Try this:' in blue * followed by each action in red on its own line. * * @returns {string[]} Returns decorated messages. */ protected formatError(error: SfError): string[]; /** * Initialize logger and ux for the command */ protected initLoggerAndUx(): Promise; /** * register events for command specific hooks */ private hooksFromLifecycleEvent; static get flags(): Flags.Input; static get usage(): string; /** * Actual command run code goes here. * * @returns {Promise} Returns a promise * @throws {Error | SfError} Throws an error. If the error is not an SfError, it will * be wrapped in an SfError. If the error contains exitCode field, process.exitCode * will set to it. */ abstract run(): Promise; }