Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if(!targetFolderName) {
console.log('The folder name for the new instantsearch project was not provided 😲'.red);
program.help();
}
console.log(`Creating your new instantsearch app: ${targetFolderName.bold}`.green);
let prompts = [
{name: 'appId', description: 'Application ID'.blue, required: true},
{name: 'apiKey', description: 'Search API key'.blue, required: true},
{name: 'indexName', description: 'Index name'.blue, required: true},
{name: 'attributeName', description: 'Main searchable attribute'.blue, required: false},
];
prompt.message = '';
prompt.override = opts;
prompt.start();
prompt.get(prompts, function(err, config) {
if(err) {
console.log('\nProject creation cancelled 😢'.red);
process.exit(0);
} else {
config.name = targetFolderName;
config.targetFolderName = path.join(process.cwd(), targetFolderName);
createProject(config);
console.log('Project successfully created 🚀'.green.bold);
}
})
}
});
rl.on('close', function() {
console.log("Password not found.");
process.exit();
});
}else{
showError("Dictionary file not found.");
}
}else{
prompt.message = "";
prompt.delimiter = "";
prompt.colors = false;
prompt.start();
(function askPassword(){
var promptSchema = {
properties: {
password: {
message:"Password:",
hidden: true
}
}
};
prompt.get(promptSchema, function (err, result) {
properties: {
username: {
required: true,
pattern: /\S+@\S+\.\S+/
},
password: {
hidden: true
}
}
};
if (!_.isEmpty(Matrix.config.user)) {
console.log(t('matrix.already_login').yellow, ' ', Matrix.config.user.username);
}
prompt.delimiter = '';
prompt.message = 'Login -- ';
prompt.start();
prompt.get(schema, function (err, result) {
Matrix.loader.start();
if (err) {
Matrix.loader.stop();
if (err.toString().indexOf('canceled') > 0) {
console.log('');
process.exit();
} else {
console.log("Error: ", err);
process.exit();
}
}
/** set the creds **/
Matrix.config.user = {
var prompt = require('prompt')
prompt.start()
prompt.message = '[' + '?'.yellow + '] '
prompt.delimiter = ''
var io = {}
io.print = function (text) {
console.log(text.white)
}
io.write = function (text) {
process.stdout.write(text)
}
io.success = function (text) {
io.print('[' + '✓'.green + ']' + ' ' + text)
}
function promptVersion(currentVersion, cb) {
shell.echo(`Current version is ${packageJson.version.toString().green.bold}`);
prompt.message = '?'.info;
prompt.colors = false;
prompt.start();
prompt.get([{
description: 'Enter the next version based on the changelog',
required: true,
conform: function(nextVersion) {
return semver.valid(nextVersion) && semver.gte(nextVersion, currentVersion);
},
message: `The version must conform to semver (MAJOR.MINOR.PATCH) and be greater than the current version (${currentVersion.bold}).`.error
}], function(err, result) {
if (err) {
shell.echo('\nCannot read the next version'.error);
process.exit(1);
}
cb(result.question);
C.prototype.checkCurrentChallenge = function() {
var df = Q.defer();
var prompt = require("prompt");
var currentChallenge = C.paths.currentChallenge;
if (fs.existsSync(currentChallenge)) {
prompt.start();
prompt.message = "";
prompt.delimiter = "";
prompt.get(
[
{
name: "answer",
message: "Current challenge will be dismissed. Continue? [y/N]"
.magenta
}
],
function(err, result) {
if (err) process.exit(1);
var answer = result.answer;
if (!result.answer) answer = "n";
answer = answer.trim().toLowerCase();
let options = {
properties: {
password: {
hidden: true,
message: 'password (typing will be hidden)',
required: true
}
}
};
if (isUsingToken) {
options.properties.password.hidden = false;
options.properties.password.message = 'access token';
}
prompt.message = '> ';
prompt.delimiter = '';
prompt.start();
prompt.get(options, (err, result) => {
if (err) console.log('\nLogin failed. Please try again.');
if (result && result.password) {
return deferred.resolve(result.password);
}
return deferred.reject;
});
return deferred.promise;
}
function getInfo(props,cb){
prompt.start();
prompt.message = '';
prompt.delimiter = "";
prompt.get({ properties: props}, cb);
}
import * as ByteBuffer from "bytebuffer";
import * as commander from "commander";
import {Decrypter} from "./aes-cbc-decrypter";
import fs = require('fs');
let bcoin = require("bcoin");
import Type = MultibitWallet.Key.Type;
import ScryptParameters = MultibitWallet.ScryptParameters;
let prompt = require('prompt');
const FIXED_IV = ByteBuffer.wrap(new Uint8Array([
0xa3, 0x44, 0x39, 0x1f, 0x53, 0x83, 0x11, 0xb3,
0x29, 0x54, 0x86, 0x16, 0xc4, 0x89, 0x72, 0x3e
]));
prompt.message = '';
prompt.delimiter = '';
let Wallet = require('../build/wallet').wallet.Wallet;
let fileName: string;
commander
.version(require('../package.json').version)
.arguments('')
.action((file: string) => {
fileName = file;
});
commander.parse(process.argv);
if (!fileName) {
const info = await new Promise(res => {
Prompt.colors = false;
Prompt.message = '';
Prompt.delimiter = '';
Prompt.override = args;
Prompt.start();
Prompt.get(PROMPT_FIELDS, (error, result) => {
if (error) {
res(undefined);
return;
}
res(result);
});
});