@zowe/imperative
Version:
framework for building configurable CLIs
62 lines • 2.61 kB
TypeScript
import * as stream from "stream";
import { ICommandDefinition } from "../ICommandDefinition";
import { IHandlerResponseApi } from "../../doc/response/api/handler/IHandlerResponseApi";
import { ICommandArguments } from "../args/ICommandArguments";
/**
* The handler parameters are passed to the instantiated command handler and populated by the command processor. The
* parameters supply everything a command handler needs to operate: arguments, response object, profiles, the command
* definition document, and more.
*
* Handlers should NEVER perform their own console/stdout/stderr invocations. The response object is provided for all
* messaging and logging capabilities.
*
* @export
* @interface IHandlerParameters
*/
export interface IHandlerParameters {
/**
* The response object used to issue messages and build responses to the command. No command should be
* writing to console/stdout/stderr directly. The response object provides the capability of collecting
* responses for the JSON response format (among other capabilities). A handler can choose to log differently,
* however a logger is also provided on the command response object.
* @type {IHandlerResponseApi}
* @memberof IHandlerParameters
*/
response: IHandlerResponseApi;
/**
* The arguments specified by the user on the command line (in the Yargs object format).
* @type {Arguments}
* @memberof IHandlerParameters
*/
arguments: ICommandArguments;
/**
* The positional options specified by the user on the command line.
* @type {(string | number)[]}
* @memberof IHandlerParameters
*/
positionals: (string | number)[];
/**
* The command definition node that defines the command being issued.
* @type {ICommandDefinition}
* @memberof IHandlerParameters
*/
definition: ICommandDefinition;
/**
* The full command definition tree that includes the command being issued.
* @type {ICommandDefinition}
* @memberof IHandlerParameters
*/
fullDefinition: ICommandDefinition;
/**
* The input stream that can be used by the command being issued.
* @type {stream.Readable}
* @memberof IHandlerParameters
*/
stdin: stream.Readable;
/**
* Has your command been invoked from a chained handler? (see ICommandDefinition.chainedHandlers)
* You can use this to influence the behavior of your command (e.g. not printing certain messages from within a chained command)
*/
isChained?: boolean;
}
//# sourceMappingURL=IHandlerParameters.d.ts.map