параметры передачи jhipster в план

Я пытаюсь создать план jhipster, чтобы переопределить функциональность Spring-Controller. Я хочу получить доступ к параметрам, запущенным из командной строки:

jhipster -d --blueprint generator-jhipster-baris-blueprint spring-controller 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')}`);
    }
}

и команда, которую я запускаю:

команда


person Baris Akkas    schedule 15.10.2018    source источник


Ответы (1)


Только что выяснил, что они существуют в опциях в контексте jhipster, что означает:

this.options.jhipsterContext.options

вместо этого

this.options
person Baris Akkas    schedule 16.10.2018