@contentstack/cli-auth
Version:
Contentstack CLI plugin for authentication activities
36 lines (35 loc) • 1.8 kB
TypeScript
import { Command } from '@contentstack/cli-command';
import { Interfaces } from '@contentstack/cli-utilities';
import { Context } from './interfaces';
export type Args<T extends typeof Command> = Interfaces.InferredArgs<T['args']>;
export type Flags<T extends typeof Command> = Interfaces.InferredFlags<(typeof BaseCommand)['baseFlags'] & T['flags']>;
export declare abstract class BaseCommand<T extends typeof Command> extends Command {
protected args: Args<T>;
protected flags: Flags<T>;
contextDetails: Context;
/**
* The `init` function initializes the command by parsing arguments and flags, registering search
* plugins, registering the configuration, and initializing the logger.
*/
init(): Promise<void>;
/**
* The catch function is used to handle errors from a command, either by adding custom logic or
* returning the parent class error handling.
* @param err - The `err` parameter is of type `Error & { exitCode?: number }`. This means that it is
* an object that extends the `Error` class and may also have an optional property `exitCode` of type
* `number`.
* @returns The parent class error handling is being returned.
*/
protected catch(err: Error & {
exitCode?: number;
}): Promise<any>;
/**
* The `finally` function is called after the `run` and `catch` functions, regardless of whether or not
* an error occurred.
* @param {Error | undefined} _ - The parameter "_" represents an error object or undefined.
* @returns The `finally` method is returning the result of calling the `finally` method of the
* superclass, which is a promise.
*/
protected finally(_: Error | undefined): Promise<any>;
protected createExportContext(apiKey?: string): Context;
}