Default Renderer
DefaultRenderer is the main renderer of listr2
.
DefaultRenderer is intended for TTY
environments with vt100
terminal compatibility, where it updates the current update constantly depending on the changes in Task. This renderer has many options for customization, these options can be changed at Listr, Subtask or Task level.
This renderer uses ProcessOutput to take control of the terminal.
Renderer Options
Details
Documentation / listr2 / ListrDefaultRendererOptions
Interface: ListrDefaultRendererOptions
Defined in: packages/listr2/src/renderer/default/renderer.interface.ts:11
Inject your custom style map consisting of icons and coloring for the ListrLogger.
See
https://listr2.kilic.dev/renderer/logger.html
Extends
RendererPresetTimer
.RendererLoggerOptions
<ListrDefaultRendererLogLevels
>.ListrLoggerStyleMap
<ListrDefaultRendererLogLevels
>
Properties
timer?
optional
timer:PresetTimer
Defined in: packages/listr2/src/presets/timer/preset.interface.ts:9
Show duration for the tasks.
Inherited from
indentation?
optional
indentation:number
Defined in: packages/listr2/src/renderer/default/renderer.interface.ts:24
Indentation per-level.
- This is a global option that can only be changed through the main Listr class.
Default Value
2
formatOutput?
optional
formatOutput:"wrap"
|"truncate"
Defined in: packages/listr2/src/renderer/default/renderer.interface.ts:32
Formats the output in to the given lines of process.stdout.columns
.
- This is a global option that can only be changed through the main Listr class.
Default Value
'wrap'
clearOutput?
optional
clearOutput:boolean
Defined in: packages/listr2/src/renderer/default/renderer.interface.ts:40
Clear all the output generated by the renderer when the Listr completes the execution successfully.
- This is a global option that can only be changed through the main Listr class.
Default Value
false
lazy?
optional
lazy:boolean
Defined in: packages/listr2/src/renderer/default/renderer.interface.ts:49
Only update the render whenever there is a incoming request through the hook.
- This is a global option that can only be changed through the main Listr class.
- Useful for snapshot tests, where this will disable showing spinner and only update the screen if something else has happened in the task worthy to show.
Default Value
false
removeEmptyLines?
optional
removeEmptyLines:boolean
Defined in: packages/listr2/src/renderer/default/renderer.interface.ts:55
Remove empty lines from the output section for decluterring multiple line output.
Default Value
true
spinner?
optional
spinner:Spinner
Defined in: packages/listr2/src/renderer/default/renderer.interface.ts:61
Spinner visually indicates that a task is running.
- You can always implement your own spinner, if the current one does not please you visually.
showSubtasks?
optional
showSubtasks:boolean
Defined in: packages/listr2/src/renderer/default/renderer.interface.ts:70
Show the subtasks of the current task.
Default Value
true
collapseSubtasks?
optional
collapseSubtasks:boolean
Defined in: packages/listr2/src/renderer/default/renderer.interface.ts:76
Collapse subtasks after current task completes its execution.
Default Value
true
showSkipMessage?
optional
showSkipMessage:boolean
Defined in: packages/listr2/src/renderer/default/renderer.interface.ts:88
Show skip messages or show the original title of the task.
true
will output the given skip message if there is any.false
will keep the current task title intact. This will also disablecollapseSkips
.
Default Value
true
collapseSkips?
optional
collapseSkips:boolean
Defined in: packages/listr2/src/renderer/default/renderer.interface.ts:97
Collapse skip messages into a single message and overwrite the task title.
true
will collapse skiped tasks.false
will show the skip message as a data output under the current task title.
Default Value
true
suffixSkips?
optional
suffixSkips:boolean
Defined in: packages/listr2/src/renderer/default/renderer.interface.ts:106
Suffix skip messages to clearly indicate the task has been skipped with in collapseSkips
mode.
true
will add[SKIPPED]
as a suffix.false
will not add a suffix.
Default Value
false
showErrorMessage?
optional
showErrorMessage:boolean
Defined in: packages/listr2/src/renderer/default/renderer.interface.ts:118
Show the error message or show the original title of the task.
true
will output the current error encountered with the task if there is any.false
will keep the current task title intact. This will also disablecollapseErrors
.
Default Value
true
collapseErrors?
optional
collapseErrors:boolean
Defined in: packages/listr2/src/renderer/default/renderer.interface.ts:127
Collapse error messages into a single message and overwrite the task title.
true
will collapse the error message.false
will show the error message as a data output under the current task title.
Default Value
true
suffixRetries?
optional
suffixRetries:boolean
Defined in: packages/listr2/src/renderer/default/renderer.interface.ts:139
Suffix retry messages to clearly indicate the task is currently retrying.
true
will add[RETRY:COUNT]
as a suffix.false
will not add a suffix.
Default Value
false
pausedTimer?
optional
pausedTimer:PresetTimer
Defined in: packages/listr2/src/renderer/default/renderer.interface.ts:148
Show duration for the pauses.
Default Value
PRESET_TIMER
color?
optional
color:Partial
<Record
<ListrDefaultRendererLogLevels
,LoggerFormat
>>
Defined in: packages/listr2/src/utils/logger/logger.interface.ts:33
Coloring of the levels.
See
https://listr2.kilic.dev/renderer/logger.html#style
Inherited from
icon?
optional
icon:Partial
<Record
<ListrDefaultRendererLogLevels
,string
| () =>string
>>
Defined in: packages/listr2/src/utils/logger/logger.interface.ts:39
Icons of the levels.
See
https://listr2.kilic.dev/renderer/logger.html#style
Inherited from
logger?
optional
logger:ListrLogger
<ListrDefaultRendererLogLevels
>
Defined in: packages/listr2/src/utils/logger/logger.interface.ts:82
Inject your custom implementation of the ListrLogger.
See
https://listr2.kilic.dev/renderer/logger.html
Inherited from
Renderer Task Options
Details
Documentation / listr2 / ListrDefaultRendererTaskOptions
Interface: ListrDefaultRendererTaskOptions
Defined in: packages/listr2/src/renderer/default/renderer.interface.ts:151
Extends
Properties
timer?
optional
timer:PresetTimer
Defined in: packages/listr2/src/presets/timer/preset.interface.ts:9
Show duration for the tasks.
Inherited from
outputBar?
optional
outputBar:number
|boolean
Defined in: packages/listr2/src/renderer/default/renderer.interface.ts:162
Write task output to the output bar under the title.
true
only keep the last line.Infinity
will keep all the lines.number
will keep the defined amount of lines.false
will not render output with this method.
Default Value
true
bottomBar?
optional
bottomBar:number
|boolean
Defined in: packages/listr2/src/renderer/default/renderer.interface.ts:176
Write task output to the bottom bar instead of the gap under the task title itself. This can be useful for stream of data coming in and is the default mode for tasks without a title.
This will take precedence over the outputBar
option, if explicitly set.
true
only keep the last line.Infinity
will keep all the lines.number
will keep the defined amount of lines.false
will not render output with this method.
Default Value
false
persistentOutput?
optional
persistentOutput:boolean
Defined in: packages/listr2/src/renderer/default/renderer.interface.ts:184
Keep output of the task after task finishes.
- This can be enabled for both normal task output under the title and bottom bar.
Default Value
false