Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
}
}
exports.getUsername = function (callback) {
process.stdout.write('Username: ');
if (!prompt.started) {
prompt.start();
}
prompt.readLine(callback);
};
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);
});
};
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)))
})
},
})
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();
});
},
exports.getPassword = function (callback) {
process.stdout.write('Password: ');
if (!prompt.started) {
prompt.start();
}
prompt.readLineHidden(callback);
};