Я пытаюсь создать проект jhipster, чтобы переопределить функциональность Spring-контроллера.Я хочу получить доступ к опциям, запущенным из командной строки:
jhipster -d - генератор пружинного контроллера blueprint-jhipster-baris-blueprint policyEffectiveStatus --path addendum
эта команда запускает мой план.Я могу получить доступ к имени «policyEffectiveStatus» из аргументов в коде:
this.argument('name', { type: String, required: true });
this.name = this.options.name;
, но я не могу получить доступ к пути опции.Как я могу передать параметры моему проекту?
Вот мой index.js:
module.exports = class extends BaseGenerator {
constructor(args, opts) {
super(args, Object.assign({ fromBlueprint: true }, opts)); // fromBlueprint
variable is important
this.argument('name', { type: String, required: true });
// This adds support for a `--path` flag
this.option('path', {
desc: 'Indicates the path for class request mapping',
type: String
});
this.path = this.options['path'];
this.log(`this.path is ${this.path}`);
this.path = this.options.path;
this.log(`this.path is ${this.path}`);
this.name = this.options.name;
const jhContext = this.jhipsterContext = this.options.jhipsterContext;
this.configOptions = jhContext.configOptions || {};
if (!jhContext) {
this.error(`This is a JHipster blueprint and should be used only like ${chalk.yellow('jhipster --blueprint generator-jhipster-sample-blueprint')}`);
}
}
и команда, которую я выполняю:
команда