///
import { Observable } from "rxjs";
import * as stream from "stream";
declare namespace Listr {
type ListrContext = any;
type ListrRendererValue = "silent" | "default" | "verbose" | ListrRendererClass;
type ListrTaskResult = string | Promise | Listr | stream.Readable | Observable;
interface ListrOptions {
concurrent?: boolean | number | undefined;
exitOnError?: boolean | undefined;
renderer?: ListrRendererValue | undefined;
nonTTYRenderer?: ListrRendererValue | undefined;
}
interface ListrEvent {
type: string;
data?: string | boolean | undefined;
}
interface ListrTask {
title: string;
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
task: (ctx: Ctx, task: ListrTaskWrapper) => void | ListrTaskResult;
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
skip?: ((ctx: Ctx) => void | boolean | string | Promise) | undefined;
enabled?: ((ctx: Ctx) => boolean | Promise | Observable) | undefined;
}
interface ListrTaskObject extends Observable {
title: string;
output?: string | undefined;
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
task: (ctx: Ctx, task: ListrTaskWrapper) => void | ListrTaskResult;
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
skip: (ctx: Ctx) => void | boolean | string | Promise;
subtasks: ReadonlyArray>;
state: string;
check: (ctx: Ctx) => void;
hasSubtasks(): boolean;
isPending(): boolean;
isSkipped(): boolean;
isCompleted(): boolean;
isEnabled(): boolean;
hasFailed(): boolean;
run: (ctx: Ctx, wrapper: ListrTaskWrapper) => Promise;
}
interface ListrTaskWrapper {
title: string;
output: string;
report(error: Error): void;
skip(message: string): void;
run(ctx?: Ctx): Promise;
}
interface ListrError extends Error {
context: Ctx;
}
interface ListrRenderer {
render(): void;
end(err: Error): void;
}
interface ListrRendererClass {
nonTTY: boolean;
new(tasks: ReadonlyArray>, options: ListrOptions): ListrRenderer;
}
}
declare class Listr {
constructor(tasks?: ReadonlyArray>, options?: Listr.ListrOptions);
constructor(options?: Listr.ListrOptions);
tasks: ReadonlyArray>;
setRenderer(value: Listr.ListrRendererValue): void;
add(tasks: Listr.ListrTask | ReadonlyArray>): void;
render(): void;
run(ctx?: Ctx): Promise;
}
export = Listr;