jozefizso / generator-license

Yeoman Generator - License
MIT License
59 stars 20 forks source link

Any ideas on using hookFor? #3

Closed Hypercubed closed 7 years ago

Hypercubed commented 11 years ago

This generator is nice. I'd like to include it in my generator (https://github.com/Hypercubed/generator-commander). I can use the hookFor and peerDependencies to run generator-license from generator-commander but it will ask again for the author name (that I am pulling from github) and license. Is there a way to skip these prompts when using hookFor? One option is to accept an author name and license from the command line arguments in generator-license.

This seams line a common potential use for generator-license. Any ideas?

Hypercubed commented 11 years ago

I'm not sure if this is the correct way but if I check for name and license in options I can run this generator from within mine by using this.invoke.

https://github.com/Hypercubed/generator-license/blob/feature-read-options/app/index.js#L38

jozefizso commented 11 years ago

I thought the props object will automatically be populated by values provided from CLI. I'm not sure was is the correct way to add support for CLI arguments, but your solution will definitely work for calls from code.

SBoudrias commented 8 years ago

Hey, this is still an issue today.

This is because the code is doing simple truthy checks !this.options.foo. The issue is that a user might already have provided an empty value in a previous generator.

I think it'd be better if we did checks for this.options.foo == null, so we'd know if we've just been passed an empty value.

iamstarkov commented 8 years ago

is it fixed after merged #20?