You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wrote a small dummy sub-generator that just prints out its arguments.
If I call it using the help flag (yo efs:action -h), I get the following output:
Usage:
yo efs:action [options] <actionFileName> <actionCreatorName>
Options:
-h, --help # Print the generator's options and usage
--skip-cache # Do not remember prompt answers Default: false
--skip-install # Do not automatically install dependencies Default: false
-sc, --skip-constant # This will skip the creation of a constant for the specific action creator. Default: false
Arguments:
actionFileName Type: String Required: true
actionCreatorName Type: String Required: true
Calling it again with yo efs:action -sc filename creatorname fails, even though it is valid as seen by the help output. Option can go before arguments. The following error is printed to the console:
Error: Did not provide required argument actionCreatorName!
at _arguments.forEach (/Users/Sven/Desktop/generator-efs/node_modules/yeoman-generator/lib/index.js:351:35)
at Array.forEach (<anonymous>)
at ActionGenerator.checkRequiredArgs (/Users/Sven/Desktop/generator-efs/node_modules/yeoman-generator/lib/index.js:347:21)
at ActionGenerator.parseOptions (/Users/Sven/Desktop/generator-efs/node_modules/yeoman-generator/lib/index.js:332:10)
at ActionGenerator.argument (/Users/Sven/Desktop/generator-efs/node_modules/yeoman-generator/lib/index.js:255:10)
at new ActionGenerator (/Users/Sven/Desktop/generator-efs/generators/action/index.js:22:14)
at Environment.instantiate (/usr/local/lib/node_modules/yo/node_modules/yeoman-environment/lib/environment.js:403:12)
at Environment.create (/usr/local/lib/node_modules/yo/node_modules/yeoman-environment/lib/environment.js:381:17)
at Environment.run (/usr/local/lib/node_modules/yo/node_modules/yeoman-environment/lib/environment.js:438:28)
at env.lookup (/usr/local/lib/node_modules/yo/lib/cli.js:156:11)
Another "issue" I found was that I can't use the alias defined in the options flag. It works only for --sc and not if I pass -sc (as I would have expected for a shortcut). -h works though.
Here is the generator if it is relevant:
'use strict';constGenerator=require('yeoman-generator');classActionGeneratorextendsGenerator{constructor(args,opts){super(args,opts);this.option('skip-constant',{alias: 'sc',desc: 'This will skip the creation of a constant for the specific action creator.',type: Boolean,default: false,});// this is the name of the actual action file. Files can hold more than one action.this.argument('actionFileName',{type: String,required: true,store: true,});this.argument('actionCreatorName',{type: String,required: true});}prompting(){// testingreturnthis.prompt([]).then(answers=>{console.log("creating action creator "+this.options.actionCreatorName+" in file "+this.options.actionFileName+". Using constant? "+this.options["skip-constant"]);});}}module.exports=ActionGenerator;
The text was updated successfully, but these errors were encountered:
I wrote a small dummy sub-generator that just prints out its arguments.
If I call it using the help flag (
yo efs:action -h
), I get the following output:Calling it again with
yo efs:action -sc filename creatorname
fails, even though it is valid as seen by the help output. Option can go before arguments. The following error is printed to the console:Another "issue" I found was that I can't use the alias defined in the options flag. It works only for
--sc
and not if I pass-sc
(as I would have expected for a shortcut).-h
works though.Here is the generator if it is relevant:
The text was updated successfully, but these errors were encountered: