// The name `constructor` is important here constructor(args, opts) { // Calling the super constructor is important so our generator is correctly set up super(args, opts) this.argument('viewName', { type: String, required: false }) if (this.options.viewName) { this.viewName = _.upperFirst(_.camelCase(this.options.viewName)) } }
prompting() { const prompts = [] if (!this.options.viewName) { prompts.push({ type: 'input', name: 'viewName', message: 'What would like to name this View?', validate: (input) => { if (input.length <= 0) { return 'You must provide a view name' } return true } }) } return this.prompt(prompts).then((answers) => { if (answers.viewName) { this.viewName = _.upperFirst(_.camelCase(answers.viewName)) } }) }