How to use the prompt.started 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
if(!config.email)
      {
         ask.push(
         {
            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 modjs / mod / lib / utils / auth.js View on Github external
exports.getUsername = function (callback) {
    process.stdout.write('Username: ');
    if (!prompt.started) {
        prompt.start();
    }
    prompt.readLine(callback);
};
github kanso / kanso / lib / utils.js View on Github external
exports.getPassword = function (callback) {
    if (!prompt.started) {
        prompt.start();
    }
    prompt.message = '';
    prompt.delimiter = '';
    var schema = { properties: {
        password: {
            description: 'Password:',
            hidden: true
        }
    }};
    prompt.get(schema, function(err, input) {
        callback(err, input && input.password);
    });
};
github skypager / skypager / src / runtimes / node / src / cli.js View on Github external
value: (schema = {}) => {
    if (!prompt.started) {
      prompt.message = process.env.SKYPAGER_CLI_PROMPT_MESSAGE || ''
      prompt.delimeter = process.env.SKYPAGER_CLI_PROMPT_DELIMETER || ''
      prompt.start()
    }

    return new Promise((resolve, reject) => {
      prompt.get({ properties: schema }, (err, results) => (err ? reject(err) : resolve(results)))
    })
  },
})
github joyent / manatee / lib / adm.js View on Github external
prompt.get(['no'], function (err, result) {
                if (err) {
                    cb(err);
                    return;
                }

                if (result.no !== 'yes' && result.no !== 'y') {
                    cb(new VError('aborting promotion due to warnings'));
                    return;
                }
                /*
                 * If we don't set this variable then the prompt library will
                 * will not re-set the message in subsequent prompts.
                 */
                prompt.started = false;
                cb();
            });
        },
github caolan / jam / lib / utils.js View on Github external
exports.getPassword = function (callback) {
    process.stdout.write('Password: ');
    if (!prompt.started) {
        prompt.start();
    }
    prompt.readLineHidden(callback);
};