Skip to content

Documentation / listr2 / Listr

Class: Listr<Ctx, Renderer, FallbackRenderer>

Create a new task list with Listr.

See

https://listr2.kilic.dev/listr/listr.html

Type parameters

Ctx = ListrContext

Renderer extends ListrRendererValue = ListrPrimaryRendererValue

FallbackRenderer extends ListrRendererValue = ListrSecondaryRendererValue

Constructors

new Listr()

new Listr<Ctx, Renderer, FallbackRenderer>(task, options?, parentTask?): Listr<Ctx, Renderer, FallbackRenderer>

Parameters

task: ListrTask<Ctx, ListrGetRendererClassFromValue<Renderer>, ListrGetRendererClassFromValue<FallbackRenderer>> | ListrTask<Ctx, ListrGetRendererClassFromValue<Renderer>, ListrGetRendererClassFromValue<FallbackRenderer>>[]

options?: ListrBaseClassOptions<Ctx, Renderer, FallbackRenderer>

parentTask?: ListrTaskObject<any, ListrGetRendererClassFromValue<Renderer>, ListrGetRendererClassFromValue<FallbackRenderer>>

Returns

Listr<Ctx, Renderer, FallbackRenderer>

Source

packages/listr2/src/listr.ts:42

Properties

tasks

tasks: ListrTaskObject<Ctx, ListrGetRendererClassFromValue<Renderer>, ListrGetRendererClassFromValue<FallbackRenderer>>[] = []

Source

packages/listr2/src/listr.ts:29


errors

errors: ListrError<Ctx>[] = []

Source

packages/listr2/src/listr.ts:30


ctx

ctx: Ctx

Source

packages/listr2/src/listr.ts:31


events

events: ListrEventManager

Source

packages/listr2/src/listr.ts:32


path

path: string[] = []

Source

packages/listr2/src/listr.ts:33


rendererClass

rendererClass: typeof ListrRenderer

Source

packages/listr2/src/listr.ts:34


rendererClassOptions

rendererClassOptions: ListrGetRendererOptions<ListrGetRendererClassFromValue<Renderer> | ListrGetRendererClassFromValue<FallbackRenderer>>

Source

packages/listr2/src/listr.ts:35


rendererSelection

rendererSelection: ListrRendererSelection

Source

packages/listr2/src/listr.ts:36


boundSignalHandler()

boundSignalHandler: () => void

Returns

void

Source

packages/listr2/src/listr.ts:37


concurrency

private concurrency: Concurrency

Source

packages/listr2/src/listr.ts:39


renderer

private renderer: ListrRenderer

Source

packages/listr2/src/listr.ts:40


task

task: ListrTask<Ctx, ListrGetRendererClassFromValue<Renderer>, ListrGetRendererClassFromValue<FallbackRenderer>> | ListrTask<Ctx, ListrGetRendererClassFromValue<Renderer>, ListrGetRendererClassFromValue<FallbackRenderer>>[]

Source

packages/listr2/src/listr.ts:43


options?

optional options: ListrBaseClassOptions<Ctx, Renderer, FallbackRenderer>

Source

packages/listr2/src/listr.ts:46


parentTask?

optional parentTask: ListrTaskObject<any, ListrGetRendererClassFromValue<Renderer>, ListrGetRendererClassFromValue<FallbackRenderer>>

Source

packages/listr2/src/listr.ts:47

Methods

isRoot()

isRoot(): boolean

Whether this is the root task.

Returns

boolean

Source

packages/listr2/src/listr.ts:123


isSubtask()

isSubtask(): boolean

Whether this is a subtask of another task list.

Returns

boolean

Source

packages/listr2/src/listr.ts:130


add()

add(tasks): void

Add tasks to current task list.

Parameters

tasks: ListrTask<Ctx, ListrGetRendererClassFromValue<Renderer>, any> | ListrTask<Ctx, ListrGetRendererClassFromValue<Renderer>, any>[]

Returns

void

See

https://listr2.kilic.dev/task/task.html

Source

packages/listr2/src/listr.ts:139


run()

run(context?): Promise<Ctx>

Run the task list.

Parameters

context?: Ctx

Returns

Promise<Ctx>

See

https://listr2.kilic.dev/listr/listr.html#run-the-generated-task-list

Source

packages/listr2/src/listr.ts:148


generate()

private generate(tasks): ListrTaskObject<Ctx, ListrGetRendererClassFromValue<Renderer>, ListrGetRendererClassFromValue<FallbackRenderer>>[]

Parameters

tasks: ListrTask<Ctx, ListrGetRendererClassFromValue<Renderer>, any> | ListrTask<Ctx, ListrGetRendererClassFromValue<Renderer>, any>[]

Returns

ListrTaskObject<Ctx, ListrGetRendererClassFromValue<Renderer>, ListrGetRendererClassFromValue<FallbackRenderer>>[]

Source

packages/listr2/src/listr.ts:183


runTask()

private runTask(task): Promise<void>

Parameters

task: ListrTaskObject<Ctx, ListrGetRendererClassFromValue<Renderer>, ListrGetRendererClassFromValue<FallbackRenderer>>

Returns

Promise<void>

Source

packages/listr2/src/listr.ts:209


signalHandler()

private signalHandler(): void

Returns

void

Source

packages/listr2/src/listr.ts:217


removeSignalHandler()

private removeSignalHandler(): void

Returns

void

Source

packages/listr2/src/listr.ts:232