How to use the prompt.message 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 algolia / create-instantsearch-app / bin / create-instantsearch-app.js View on Github external
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);
  }
})
github koalazak / blockchaininfoPasswdToolkit / app.js View on Github external
}
			  
			});
			
			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) {
github matrix-io / matrix-cli / bin / matrix-login.js View on Github external
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 = {
github XervoIO / cli / lib / common / io.js View on Github external
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)
}
github algolia / algoliasearch-helper-js / scripts / release.js View on Github external
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);
github shime / codewars / index.js View on Github external
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();
github vtex / toolbelt / src / lib / auth / login.js View on Github external
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;
}
github stormpath / stormpath-restify / examples / things-api / register.js View on Github external
function getInfo(props,cb){
  prompt.start();
  prompt.message = '';
  prompt.delimiter = "";
  prompt.get({ properties: props}, cb);
}
github Multibit-Legacy / read-multibit-wallet-file / src / mbexport.ts View on Github external
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) {
github resistdesign / rdx / src / Commands / App.jsx View on Github external
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);
      });
    });