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

Descendant tasks should also be rendered when all subtasks have no title #663

Closed
grtan opened this issue Mar 1, 2023 · 5 comments
Closed
Labels

Comments

@grtan
Copy link

grtan commented Mar 1, 2023

image

const {Listr} = require('listr2')

function check(name, parentTask) {
  return new Listr({
    title: `check task ${name}`,
    task(ctx, task) {
      // do check
    },
  }, {}, parentTask)
}

const tasks = new Listr([
  {
    title: 'check',
    task: (ctx, task) => task.newListr([
      {
        // I must set the title, it will work fine
        // title: 'xxx',
        task: (ctx, task) => check(1, task.task),
      },
      {
        task: (ctx, task) => check(2, task.task),
      },
      {
        task: (ctx, task) => check(3, task.task),
      },
    ], {
      concurrent: true,
    }),
  },
  {
    title: 'check result',
    task: async (ctx, task) => {
      // do something
    },
  },
],  {
  rendererOptions: {
    collapse: false,
  },
})

tasks.run()

The console print as below, but I want to print the title of check's children task. How can i print check task 1, check task 2, check task 3 currently?
image

@cenk1cenk2
Copy link
Collaborator

Hello @grtan,

Yeah I suppose that part should be removed. I do not remember exactly what that was for but I assume that it might be breaking compatability when removed.

@grtan
Copy link
Author

grtan commented Mar 2, 2023

@cenk1cenk2 Any plans for the future? If it cannot be removed uniformly, is it possible to customize the configuration in rendererOptions?

@cenk1cenk2
Copy link
Collaborator

Sorry for the late reply, it has been hectic for me for quite some time. This seems to be breaking nothing in the current behavior. I suppose I have put that in to save some CPU cycles but it is not important since the renderer is not in its most efficient form, the new release should be published now.

https://gitlab.kilic.dev/libraries/listr2/-/pipelines/44355

cenk1cenk2 pushed a commit that referenced this issue Mar 11, 2023
## [5.0.8](v5.0.7...v5.0.8) (2023-03-11)

### Bug Fixes

* render subtasks of the subtasks if parent has no title ([7b443f9](7b443f9)), closes [#663](#663)
@cenk1cenk2
Copy link
Collaborator

🎉 This issue has been resolved in version 5.0.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

@grtan
Copy link
Author

grtan commented Mar 17, 2023

@cenk1cenk2 Thanks for your work🎉

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

No branches or pull requests

2 participants