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(task, options, parentTask)

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<Renderer>>[]

options?: ListrBaseClassOptions<Ctx, Renderer, FallbackRenderer>

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

Returns

Listr<Ctx, Renderer, FallbackRenderer>

Source

packages/listr2/src/listr.ts:41

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


concurrency

private concurrency: Concurrency

Source

packages/listr2/src/listr.ts:38


renderer

private renderer: ListrRenderer

Source

packages/listr2/src/listr.ts:39


task

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

Source

packages/listr2/src/listr.ts:42


options?

optional options: ListrBaseClassOptions<Ctx, Renderer, FallbackRenderer>

Source

packages/listr2/src/listr.ts:45


parentTask?

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

Source

packages/listr2/src/listr.ts:46

Methods

add()

add(tasks): void

Parameters

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

Returns

void

Source

packages/listr2/src/listr.ts:130


run()

run(context?): Promise<Ctx>

Parameters

context?: Ctx

Returns

Promise<Ctx>

Source

packages/listr2/src/listr.ts:134


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:165


runTask()

private runTask(task): Promise<void>

Parameters

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

Returns

Promise<void>

Source

packages/listr2/src/listr.ts:191