Options
All
  • Public
  • Public/Protected
  • All
Menu

ListrTask.

Defines the task, conditions and options to run a specific task in the listr.

Type parameters

Hierarchy

  • ListrTask

Index

Properties

enabled?: boolean | ((ctx: Ctx) => boolean | Promise<boolean>)

Enable a task depending on the context.

The function that has been passed in will be evaluated at the initial creation of the Listr class for rendering purposes, as well as re-evaluated when the time for that specific task has come.

exitOnError?: boolean | ((ctx: Ctx) => boolean | Promise<boolean>)

Set exit on the error option from task-level instead of setting it for all the subtasks.

options?: ListrGetRendererTaskOptions<Renderer>

Per task options, that depends on the selected renderer.

These options depend on the implementation of the selected renderer. If the selected renderer has no options it will be displayed as never.

retry?: number

Adds the given number of retry attempts to the task if the task fails.

skip?: string | boolean | ((ctx: Ctx) => string | boolean | Promise<string | boolean>)

Skip this task depending on the context.

The function that has been passed in will be evaluated at the runtime when the task tries to initially run.

title?: string

Title of the task.

Give this task a title if you want to track it by name in the current renderer.

Tasks without a title will hide in the default renderer and are useful for running a background instance. On verbose renderer, state changes from these tasks will log as 'Task without a title.'

Methods

  • Runs a specific event if the current task or any of the subtasks has failed.

    Mostly useful for rollback purposes for subtasks. But can also be useful whenever a task is failed and some measures have to be taken to ensure the state is not changed.

    Parameters

    Returns void | ListrTaskResult<Ctx>

  • The task itself.

    Task can be a sync or async function, an Observable, or a Stream. Task will be executed, if the certain criteria of the state are met and whenever the time for that specific task has come.

    Parameters

    Returns void | ListrTaskResult<Ctx>