How to use the prompt.get 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 soomtong / blititor / core / setup.js View on Github external
pattern: /^\w+$/,
                message: 'Host name must be only letters',
                required: true
            },
            db_user_password: {
                description: 'Enter your password',
                type: 'string',
                message: 'Password must be letters',
                hidden: true,
                replace: '*',
                required: true
            }
        }
    };

    prompt.get(configScheme, function (err, result) {
        let config = {};

        try {
            config = require(path.join('..', configFile));
        } catch (e) {
            console.log(' = Make new config.json file in root folder...');
            fs.writeFileSync(configFile, JSON.stringify(config, null, 4));
        }

        if(!result){
            return console.log('\n 취소되었습니다.')
        }

        // validate dbTablePrefix (ex. test => b_test_, b_test = b_test_)
        const dbTablePrefix = validateDatabaseTablePrefix(result['db_table_prefix']);
github brave-intl / brave-payments-tools / cli.js View on Github external
fs.access(file, fs.F_OK, (err) => {
        const prompts = []

        if (!err) throw new Error('file exists: ' + file)

        prompt.start()
        if (program.provider === 'bitgo') {
          if (program.user) schema.password.description = program.user + ' password'
          else prompts.push(schema.username)
          prompts.push(schema.password)
          prompts.push(schema.enterpriseId)
        }
//      if (!program.otp) prompts.push(schema.otp)
        prompts.push(schema.accessToken)
        prompt.get(prompts, (err, result) => {
          if (err) throw err

          config.authenticate.username = program.user || result.username
          config.authenticate = update(config.authenticate, underscore.omit(result, [ 'enterpriseId' ]))
          if (result.enterpriseId) config.enterpriseId = result.enterpriseId
          provider.online.authenticate(config, (err, options) => {
            if (err) throw err

            provider.online.createWallet(options, (err, wallet) => {
              if (err) throw err

              config.authenticate = underscore.pick(config.authenticate, [ 'username' ])
              config.wallet = underscore.pick(wallet, [ 'id', 'label', 'currency' ])
              config = underscore.pick(config, [ 'config', 'label', 'authenticate', 'wallet' ])
              writeFile(file, config)
            })
github sitefinitysteve / nativescript-auth0 / scripts / postclone.js View on Github external
function askPluginName() {
    if (inputParams.plugin_name !== undefined) {
        generateClassName();
    } else {
        prompt.get({
            name: 'plugin_name',
            description: 'What will be the name of your plugin? Use lowercase characters and dashes only. Example: yourplugin / google-maps / bluetooth'
        }, function (err, result) {
            if (err) {
                return console.log(err);
            }
            if (!result.plugin_name) {
                return console.log("Your plugin name is required to correct the file names and classes.");
            }

            inputParams.plugin_name = result.plugin_name;

            if (inputParams.plugin_name.startsWith("nativescript-")) {
                inputParams.plugin_name = inputParams.plugin_name.replace("nativescript-", "");
            }
github adaptlearning / adapt_authoring / lib / installHelpers.js View on Github external
function getInput(items, callback) {
  prompt.message = '> ';
  prompt.delimiter = '';
  prompt.start();
  prompt.get(items, function(error, result) {
    if(error) {
      if(error.message === 'canceled') error = new Error('User cancelled the process');
      return exit(1, error);
    }
    callback(result);
  });
}
github QubitProducts / cherrytree / tasks / release.js View on Github external
var yellow = color.yellow

var schema = {
  properties: {
    version: {
      description: 'version? (old is ' + version() + ')',
      pattern: /^[0-9]\.[0-9]+\.[0-9](-.+)?/,
      message: 'Must be a valid semver string i.e. 1.0.2, 2.3.0-beta.1',
      required: true
    }
  }
}

prompt.start()

prompt.get(schema, function (err, result) {
  if (err) return
  var rawVersion = result.version
  var version = 'v' + rawVersion
  updatePkgJSON(rawVersion)
  rebuild(function () {
    commit(version, function () {
      tag(version, function () {
        publish(version)
      })
    })
  })
})

function rebuild (cb) {
  ex('npm run build', cb)
}
github mapbox / HecateJS / lib / styles.js View on Github external
return main();
        } else if (options.cli) {
            cb = cli;

            prompt.message = '$';
            prompt.start({
                stdout: process.stderr
            });

            let args = [];

            if (self.api.auth_rules && self.api.auth_rules.style.list !== 'public') {
                args = args.concat(auth(self.api.user));
            }

            prompt.get(args, (err, argv) => {
                if (err) throw err;

                prompt.stop();

                if (argv.hecate_username) {
                    self.api.user = {
                        username: argv.hecate_username,
                        password: argv.hecate_password
                    };
                }

                return main();
            });
        } else {
            return main();
        }
github AdFabConnect / adfab-gulp-boilerplate / scripts / postinstall.js View on Github external
], (err, result) => {
            this.userData = result;
            if(this.technoList[this.userData.techno].hasOwnProperty('prompt')) {
                prompt.start('');
                prompt.get(this.technoList[this.userData.techno].prompt, (err, result) => {
                    for(var technoPrompt of this.technoList[this.userData.techno].prompt) {
                        this.userData[technoPrompt.name] = result[technoPrompt.name];
                    }
                    this.selectSourcesFolder();
                });
            } else {
                this.selectSourcesFolder();
            }
        }); 
    }
github mapbox / HecateJS / lib / clone.js View on Github external
return main();
        } else if (options.cli) {
            cb = cli;

            prompt.message = '$';
            prompt.start({
                stdout: process.stderr
            });

            let args = [];

            if (!self.api.user && self.api.auth_rules && self.api.auth_rules.clone.get !== 'public') {
                args = args.concat(auth(self.api.user));
            }

            prompt.get(args, (err, argv) => {
                prompt.stop();

                if (argv.hecate_username) {
                    self.api.user = {
                        username: argv.hecate_username,
                        password: argv.hecate_password
                    };
                }

                options.output = process.stdout;

                return main();
            });
        } else {
            return main();
        }
github mapbox / HecateJS / lib / bbox.js View on Github external
stdout: process.stderr
        });

        let args = [{
            name: 'bbox',
            message: 'bbox to download',
            required: true,
            type: 'string',
            default: options.bbox
        }];

        if (this.api.auth_rules && this.api.auth_rules.feature.get !== 'public') {
            args = args.concat(auth(this.api.user));
        }

        prompt.get(args, (err, argv) => {
            prompt.stop();

            if (argv.username) {
                this.api.user = {
                    username: argv.username,
                    password: argv.password
                };
            }

            return run(argv);
        });

        function run(argv) {
            self.main(argv, (err, res) => {
                if (err) throw err;