Listr2
This is the expanded and re-written in Typescript version of the beautiful plugin by Sam Verschueren called Listr. Fully backwards compatible with the Listr itself but with more features.
How to use
Check out example.ts
in the root of the repository for the code in demo.
import { Listr } from 'Listr2'
interface ListrCtx {
injectedContext: boolean
}
const tasks = new Listr<ListrCtx>(
[
{
title: 'Hello I am a title',
task: async (ctx, task): Promise<void> => {}
}
],
{
showSubtasks: true,
concurrent: false,
exitOnError: true,
bottomBarItems: 3,
ctx: someOtherContextObject
}
)
const ctx = await tasks.run()
Input Module
Todo ATM.
Inject Context
Context which is the object that is being used while executing the actions in the Listr can now be enjected to the next Listr through using the custom options.
Bottom Bar For More Information
Default renderer now supports a bottom bar to dump the output if desired. The output lenght can be limited through options of the Listr class.
Tasks without Titles
Tasks can be created without titles, and if any output is dumped it will be dumped to the bottom bar instead. If a task with no title is returns a new Listr task, it can be used to change the parallel task count and execute those particular tasks in order or in parallel. The subtasks of the untitled tasks will drop down one indentation level to be consistent.
Multi-Line Renderer
The default update renderer now supports multi-line rendering. Therefore implementations like pushing through multi-line data now works properly.
Fully-Typed
You can download the types if you are starting a new Typescript project.