Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
This repository was 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

Description

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));
}

Activity

  1. dnoliver commented on Nov 1, 2016

    @dnoliver
    Author

    I can contribute with this feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions