How to use the prompt.resume 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 csantanapr / cdvlive / src / address.ts View on Github external
prompt.get({ properties: promptProperties }, function(err: any, promptResult: any) {
        if (err && err.message !== 'canceled') {
          console.error('User prompted to select address - an error occured: %s', err, {});
          q.reject(err);
        }

        var selection = promptResult.selection;
        for (x = 0; x < addresses.length; x += 1) {
          if (selection == x + 1 || selection == addresses[x].address || selection == addresses[x].dev) {
            options.address = addresses[x].address;
            if (!options.isAddressCmd) {
              console.log(chalk.green.bold('Selected address: ') + options.address);
            }
            cdvliveConfig.set(addressConfigKey, options.address);
            prompt.resume();
            q.resolve(options.address);
            return q.promise;
          }
        }

        console.error('Invalid address selection');
      });
github ionic-team / ionic-app-lib / lib / serve.js View on Github external
}

        if (err && err.message === 'canceled') {
          log.info('Canceled by user');
          process.exit(1);
        }

        var selection = promptResult.selection;
        for (var x = 0; x < addresses.length; x += 1) {
          if (parseInt(selection) === (x + 1) || selection === addresses[x].address || selection === addresses[x].dev) {
            options.address = addresses[x].address;
            if (!options.isAddressCmd) {
              log.info('Selected address: ' + options.address);
            }
            ionicConfig.set(addressConfigKey, options.address);
            prompt.resume();
            q.resolve();
            return q.promise;
          }
        }

        Utils.fail('Invalid address selection');
      });
github csantanapr / cdvlive / src / address.js View on Github external
prompt.get({ properties: promptProperties }, function (err, promptResult) {
                if (err && err.message !== 'canceled') {
                    console.error('User prompted to select address - an error occured: %s', err, {});
                    q.reject(err);
                }
                var selection = promptResult.selection;
                for (x = 0; x < addresses.length; x += 1) {
                    if (selection == x + 1 || selection == addresses[x].address || selection == addresses[x].dev) {
                        options.address = addresses[x].address;
                        if (!options.isAddressCmd) {
                            console.log(chalk.green.bold('Selected address: ') + options.address);
                        }
                        cdvliveConfig.set(addressConfigKey, options.address);
                        prompt.resume();
                        q.resolve(options.address);
                        return q.promise;
                    }
                }
                console.error('Invalid address selection');
            });
        }