sao icon indicating copy to clipboard operation
sao copied to clipboard

Execute sub generator, based on some prompt value

Open brpaz opened this issue 7 years ago • 2 comments

Hello. Its possible to execute a sub-generator only if some prompt has a specific value?

brpaz avatar Nov 09 '18 19:11 brpaz

Maybe we can add a new type of action:

{
  type: 'run-generator',
  generator: './generators/some-generator',
  when(answers) {
    return answers.someCondition
  }
}

egoist avatar Nov 10 '18 12:11 egoist

Yes, I think that would work well.

My use case for this is for example, lets say I want to generate a LICENSE file in multiple generators. I dont want to repeat the code to ask the user to select the type of license for example. Instead I can use another generator to do the task.

brpaz avatar Nov 10 '18 14:11 brpaz