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>

Defined in

packages/listr2/src/listr.ts:42

Properties

tasks

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

Defined in

packages/listr2/src/listr.ts:29


errors

errors: ListrError<Ctx>[] = []

Defined in

packages/listr2/src/listr.ts:30


ctx

ctx: Ctx

Defined in

packages/listr2/src/listr.ts:31


events

events: ListrEventManager

Defined in

packages/listr2/src/listr.ts:32


path

path: string[] = []

Defined in

packages/listr2/src/listr.ts:33


rendererClass

rendererClass: typeof ListrRenderer

Defined in

packages/listr2/src/listr.ts:34


rendererClassOptions

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

Defined in

packages/listr2/src/listr.ts:35


rendererSelection

rendererSelection: ListrRendererSelection

Defined in

packages/listr2/src/listr.ts:36


boundSignalHandler()

boundSignalHandler: () => void

Returns

void

Defined in

packages/listr2/src/listr.ts:37


task

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

Defined in

packages/listr2/src/listr.ts:43


options?

optional options: ListrBaseClassOptions<Ctx, Renderer, FallbackRenderer>

Defined in

packages/listr2/src/listr.ts:46


parentTask?

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

Defined in

packages/listr2/src/listr.ts:47

Methods

isRoot()

isRoot(): boolean

Whether this is the root task.

Returns

boolean

Defined in

packages/listr2/src/listr.ts:123


isSubtask()

isSubtask(): boolean

Whether this is a subtask of another task list.

Returns

boolean

Defined in

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

Defined in

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

Defined in

packages/listr2/src/listr.ts:148