How to use the prompt.getInput 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 fredwu / skinny-coffee-machine / node_modules / grunt-coffee / node_modules / grunt / tasks / init.js View on Github external
var validator = option.validator;
          option.validator = function(line, next) {
            if (line === '?') {
              return next(false);
            } else if (validator) {
              if (validator.test) {
                return next(validator.test(line));
              } else if (typeof validator === 'function') {
                return validator.length < 2 ? next(validator(line)) : validator(line, next);
              }
            }
            next(true);
          };
          // Actually get user input.
          prompt.start();
          prompt.getInput(option, function(err, line) {
            if (err) { return done(err); }
            option.validator = validator;
            result[option.name] = line;
            done();
          });
        });
      }, function(err) {
github gruntjs / grunt-init / tasks / lib / prompt.js View on Github external
} else if (validator) {
              if (validator.test) {
                return next(validator.test(line));
              } else if (typeof validator === 'function') {
                return validator.length < 2 ? next(validator(line)) : validator(line, next);
              }
            }
            next(true);
          };
          // Actually get user input.
          if (useDefaults) {
            result[option.name] = option.default;
            done();
          } else {
            prompt.start();
            prompt.getInput(option, function(err, line) {
              if (err) { return done(err); }
              option.validator = validator;
              result[option.name] = line;
              done();
            });
          }
        });
      }, function() {
github gruntjs / grunt / tasks / lib / prompt.js View on Github external
var validator = option.validator;
          option.validator = function(line, next) {
            if (line === '?') {
              return next(false);
            } else if (validator) {
              if (validator.test) {
                return next(validator.test(line));
              } else if (typeof validator === 'function') {
                return validator.length < 2 ? next(validator(line)) : validator(line, next);
              }
            }
            next(true);
          };
          // Actually get user input.
          prompt.start();
          prompt.getInput(option, function(err, line) {
            if (err) { return done(err); }
            option.validator = validator;
            result[option.name] = line;
            done();
          });
        });
      }, function() {
github tbranyen / backbone-boilerplate / build / node_modules / grunt / tasks / init.js View on Github external
function doPrompt() {
        prompt.start();
        prompt.getInput(option, function(err, line) {
          if (err) { return done(err); }
          result[option.name] = line;
          done();
        });
      }
      // If the default value is a function, execute that function, using the