listr2
Advanced tools
Comparing version 1.1.5 to 1.1.6
import { ListrContext, ListrTask, ListrOptions } from './listr.interface'; | ||
export declare class ManagerClass<Ctx = ListrContext> { | ||
private initially; | ||
private tasks; | ||
private finally; | ||
constructor(options?: ManagerOptions); | ||
@@ -10,3 +7,3 @@ addInitial<Ctx>(tasks: ListrTask<Ctx>[]): void; | ||
addFinal<Ctx>(tasks: ListrTask<Ctx>[]): void; | ||
runAll<Ctx>(options?: Exclude<ListrOptions, { | ||
runAll<Ctx>(options?: Exclude<ListrOptions<Ctx>, { | ||
concurrent: any; | ||
@@ -17,4 +14,15 @@ }>): Promise<Ctx>; | ||
} | ||
export interface ManagerInjectOptions<Ctx = ListrContext> { | ||
initial?: Exclude<ListrOptions<Ctx>, { | ||
concurrent: any; | ||
}>; | ||
parallel?: Exclude<ListrOptions<Ctx>, { | ||
concurrent: any; | ||
}>; | ||
final?: Exclude<ListrOptions<Ctx>, { | ||
concurrent: any; | ||
}>; | ||
} | ||
export interface ManagerOptions { | ||
showRunTime?: boolean; | ||
} |
import { ListrContext, ListrOptions, ListrTask } from './interfaces/listr.interface'; | ||
import { ManagerOptions } from './interfaces/manager.interface'; | ||
import { ManagerOptions, ManagerInjectOptions } from './interfaces/manager.interface'; | ||
export declare class Manager<InjectCtx = ListrContext> { | ||
private options?; | ||
private initially; | ||
private initialOptions; | ||
private tasks; | ||
private parallelOptions; | ||
private finally; | ||
private finalOptions; | ||
constructor(options?: ManagerOptions); | ||
@@ -12,7 +15,8 @@ addInitial<Ctx = InjectCtx>(tasks: ListrTask<Ctx>[]): void; | ||
addFinal<Ctx = InjectCtx>(tasks: ListrTask<Ctx>[]): void; | ||
injectOptions(options: ManagerInjectOptions): void; | ||
runAll<Ctx = InjectCtx>(options?: Exclude<ListrOptions, { | ||
concurrent: any; | ||
}>): Promise<Ctx>; | ||
run<Ctx>(tasks: ListrTask<Ctx>[], options?: ListrOptions): Promise<Ctx>; | ||
run<Ctx>(tasks: ListrTask<Ctx>[], options?: ListrOptions<Ctx>): Promise<Ctx>; | ||
getRuntime(pipetime: number): string; | ||
} |
@@ -21,2 +21,13 @@ "use strict"; | ||
} | ||
injectOptions(options) { | ||
if (options === null || options === void 0 ? void 0 : options.initial) { | ||
this.initialOptions = options.initial; | ||
} | ||
if (options === null || options === void 0 ? void 0 : options.parallel) { | ||
this.parallelOptions = options.parallel; | ||
} | ||
if (options === null || options === void 0 ? void 0 : options.final) { | ||
this.finalOptions = options.final; | ||
} | ||
} | ||
async runAll(options) { | ||
@@ -27,3 +38,3 @@ let pipetime; | ||
enabled: () => this.initially.length > 0, | ||
task: () => new listr_1.Listr(this.initially) | ||
task: () => new listr_1.Listr(this.initially, this.initialOptions) | ||
}, | ||
@@ -34,3 +45,3 @@ { | ||
pipetime = Date.now(); | ||
return new listr_1.Listr(this.tasks, { concurrent: true }); | ||
return new listr_1.Listr(this.tasks, { concurrent: true, ...this.parallelOptions }); | ||
} | ||
@@ -44,3 +55,3 @@ }, | ||
enabled: () => this.finally.length > 0, | ||
task: () => new listr_1.Listr(this.finally) | ||
task: () => new listr_1.Listr(this.finally, this.finalOptions) | ||
}, | ||
@@ -50,4 +61,7 @@ { | ||
this.initially = []; | ||
this.initialOptions = {}; | ||
this.tasks = []; | ||
this.parallelOptions = {}; | ||
this.finally = []; | ||
this.finalOptions = {}; | ||
} | ||
@@ -54,0 +68,0 @@ } |
{ | ||
"name": "listr2", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "Terminal task list reborn!", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
76653
1148