Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Allow generator-docker to be called with options, and prevent prompt #123

Open
dnoliver opened this issue Nov 1, 2016 · 1 comment
Open

Comments

@dnoliver
Copy link

dnoliver commented Nov 1, 2016

To improve composability, add options to the generator code.

  1. use the options as default properties
  2. do not prompt for parameters when an option is already defined

i.e:

constructor: function () {
  yeoman.Base.apply(this, arguments);

  this.option('boilerplate', {
      type: Boolean,
      required: false,
      desc: 'Include Boilerplate'
  });
},

initializing: function () {
  this.props = {
      boilerplate: Boolean(this.options.boilerplate)
  };
},

prompting: function () {
  var prompts = [{
      type: 'confirm',
      name: 'boilerplate',
      message: 'Include Boilerplate',
      default: true,,
      when: this.options.boilerplate === undefined
    }];

  return this.prompt(prompts)
      .then(function (props) {
        this.props = extend(this.props, props);
      }.bind(this));
}
@dnoliver
Copy link
Author

dnoliver commented Nov 1, 2016

I can contribute with this feature

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant