Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add output clearing to default renderer #704

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tommy-mitchell
Copy link

Closes #703.

I've only added it when using the default renderer with the output bar. Currently, setting task.output to an empty string clears the output:

task.output = ''

I've added an example as well. I'm not sure how to set up the snapshot tests with an ID.

Should I add output clearing elsewhere? (e.g. with another renderer or with the bottom bar, etc)

@cenk1cenk2
Copy link
Collaborator

Dear @tommy-mitchell,

Since empty strings happen at any point while logging a stream out, I would like to make that clearing intentional like maybe passing null to the task.output as you have did it.

But a more integrated way of doing this would be using https://github.com/listr2/listr2/blob/master/packages/listr2/src/lib/task-wrapper.ts which is the task you see as a user that is injected to all the tasks. This would emit an event on https://github.com/listr2/listr2/blob/master/packages/listr2/src/lib/task.ts where it can be listened to on the specific renderer that implements this. Instead of creating a function on the task, task-wrapper may directly emit the event since there is no specific function needed.

If this seems like a lot of changes I guess null is fine as a value to give to output. You just have to be sure that you clean the output bar as well as the bottom bar and update documentation as necassary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Support]: Is there a way to clear output per task?
2 participants