@kui-shell/core
Version:
An Electron-based shell for cloud-native development
42 lines (41 loc) • 1.63 kB
TypeScript
import Tab from '../webapp/tab';
import ExecOptions from '../models/execOptions';
import { CommandLine, CommandOptions, ExecType, KResponse, ParsedOptions } from '../models/command';
export interface CommandStartEvent {
tab: Tab;
startTime: number;
route: string;
command: string;
execUUID: string;
execType: ExecType;
execOptions: ExecOptions;
echo: boolean;
evaluatorOptions: CommandOptions;
pipeStages: CommandLine['pipeStages'];
/** The output will be redirected to a file; do not display any live output */
redirectDesired: boolean;
}
export type ResponseType = 'MultiModalResponse' | 'NavResponse' | 'ScalarResponse' | 'Incomplete' | 'Error';
export interface CommandCompleteEvent<R extends KResponse = KResponse, T extends ResponseType = ResponseType> {
tab: Tab;
completeTime: number;
command: string;
argvNoOptions: string[];
parsedOptions: ParsedOptions;
execOptions: ExecOptions;
pipeStages: CommandLine['pipeStages'];
execUUID: string;
execType: ExecType;
cancelled: boolean;
echo: boolean;
evaluatorOptions: CommandOptions;
response: R;
responseType: T;
historyIdx: number;
}
export type CommandStartHandler = (event: CommandStartEvent) => void;
export type CommandCompleteHandler<R extends KResponse = KResponse, T extends ResponseType = ResponseType> = (event: CommandCompleteEvent<R, T>) => void;
/** In order to snapshot an event, we'll need to remember just the tab uuid */
export type SnapshottedEvent<E extends CommandStartEvent | CommandCompleteEvent> = Omit<E, 'tab'> & {
tab: E['tab']['uuid'];
};