UNPKG

1.47 kBTypeScriptView Raw
1export interface ITask {
2 action: string;
3 status: string | undefined;
4 active: boolean;
5}
6export declare type ActionType = 'spinner' | 'simple' | 'debug';
7export interface Options {
8 stdout?: boolean;
9}
10export declare class ActionBase {
11 type: ActionType;
12 std: 'stdout' | 'stderr';
13 protected stdmocks?: ['stdout' | 'stderr', string[]][];
14 private stdmockOrigs;
15 start(action: string, status?: string, opts?: Options): void;
16 stop(msg?: string): void;
17 private get globals();
18 get task(): ITask | undefined;
19 set task(task: ITask | undefined);
20 protected get output(): string | undefined;
21 protected set output(output: string | undefined);
22 get running(): boolean;
23 get status(): string | undefined;
24 set status(status: string | undefined);
25 pauseAsync(fn: () => Promise<any>, icon?: string): Promise<any>;
26 pause(fn: () => any, icon?: string): any;
27 protected _start(): void;
28 protected _stop(_: string): void;
29 protected _resume(): void;
30 protected _pause(_?: string): void;
31 protected _updateStatus(_: string | undefined, __?: string): void;
32 /**
33 * mock out stdout/stderr so it doesn't screw up the rendering
34 */
35 protected _stdout(toggle: boolean): void;
36 /**
37 * flush mocked stdout/stderr
38 */
39 protected _flushStdout(): void;
40 /**
41 * write to the real stdout/stderr
42 */
43 protected _write(std: 'stdout' | 'stderr', s: string | string[]): void;
44}