Closed nwinkler closed 10 years ago
OK, the first item seems to be fixed by this recent commit: https://github.com/yeoman/generator/commit/4c21283a7b6a8b70235954ad28f02aeb5130f8b3
I'm using version 0.13.4, which doesn't include this commit - so that explains that.
The issue with the required attribute and help seems to be a bit of a chicken/egg issue. The problems is caused by the fact that the Base.prototype.argument
function both defines the expected argument and also immediately checks for its presence if the argument is defined as required.
If we add a check for the help option before defining the required parameters, we can print the help message, but it won't include the required parameters, since they haven't been defined yet.
The clean way to fix this would be to split up the definition of the parameters and then check for the required parameters later:
help
option. If it's set, print the help message including the definition of the required parameters and then exit.Hi, this have been fixed in this commit: https://github.com/yeoman/generator/commit/4c21283a7b6a8b70235954ad28f02aeb5130f8b3
It should be published with the next yeoman-generator release. Stay tune.
I've noticed a couple of weird things with the
--help
option:--help
option for a generator, the help message always shows the help for theinit
command. Example:yo generator --help
showsyeoman init [options]
, whereas I would expect something likeyo generator [options]
.--help
option for a sub-generator that expects a name parameter (extendingNamedBase
) always throws an error due to the missing required parameter. Example:yo generator:subgenerator --help
gives the following error:This is rather unexpected. When using the
--help
option, I shouldn't need to know that I need to provide a required argument.yo generator:subgenerator --help foo
works fine, but I find it rather unnecessary that I need to provide the dummyfoo
argument just to find out the expected arguments and options. Usability would be a lot better if I wouldn't have to know about required parameters if I'm just calling help.Does that make sense?