How to use the prompt.addProperties function in prompt

To help you get started, we’ve selected a few prompt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eleith / emailjs / test / run.js View on Github external
name:       'email',
            message:    'your email address',
            empty:      false,
            validator:  /.+@.+/,
            warning:    'not a valid email address'
         });
      }
   
      if(ask.length)
      {
         if(!prompt.started)
            prompt.start();

         prompt.message = "";
         prompt.delimiter = ">";
         prompt.addProperties(config, ask, function(err) 
         { 
            process.stdin.destroy();
            run.tests(config); 
         });
      }
      else
      {
         process.stdin.destroy();
         run.tests(config);
      }
   }
};
github garbados / quilter / bin / quilt.js View on Github external
function promptForOptions (obj, fields, cb) {
  if (typeof(fields) === 'function') {
    cb = fields;
    fields = ['mount', 'remote'];
  }
  var properties = [];
  prompt.start();

  fields.forEach(function (val) {
    if (!obj[val]) properties.push(val);
  });

  if (properties.length) {
    prompt.addProperties(obj, properties, function (err) {
      cb(obj);
    }); 
  } else {
    cb(obj);
  }
}
github pmarkert / hyperpotamus / lib / actions / prompt.js View on Github external
module.exports.process = function (context, callback) {
	for (var i = this.prompt.length - 1; i >= 0; i--) {
		if (_.isObject(this.prompt[i].pattern) && !_.isRegExp(this.prompt[i].pattern)) {
			this.prompt[i].pattern = regex_helper.make_regex(this.prompt[i].pattern, context);
		}
	}
	this.prompt = _.filter(this.prompt, function (item) {
		return item.required || _.isUndefined(_.get(context.session, item.name));
	});
	prompt.override = context.sesion;
	prompt.message = "hyperpotamus";
	prompt.colors = false;
	prompt.start();
	prompt.addProperties(context.session, this.prompt, function () {
		callback();
	});
};