Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jhipster将选项传递给blueprint_Jhipster_Options_Blueprint - Fatal编程技术网

jhipster将选项传递给blueprint

jhipster将选项传递给blueprint,jhipster,options,blueprint,Jhipster,Options,Blueprint,我试图创建一个jhipster蓝图来覆盖spring控制器的功能。我想访问从命令行运行的选项: jhipster-d——蓝图生成器jhipster baris blueprint spring控制器策略有效状态——路径补遗 这个命令使我的蓝图运行。我可以通过以下方式从代码中的参数访问名称“policyEffectiveStatus”: this.argument('name', { type: String, required: true }); this.name = this.options

我试图创建一个jhipster蓝图来覆盖spring控制器的功能。我想访问从命令行运行的选项:

jhipster-d——蓝图生成器jhipster baris blueprint spring控制器策略有效状态——路径补遗

这个命令使我的蓝图运行。我可以通过以下方式从代码中的参数访问名称“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')}`);
    }
}
我正在运行的命令是:


刚刚发现它们存在于jhipster上下文下的选项中,这意味着:

this.options.jhipsterContext.options
而不是这个

this.options