How to use the prompt.confirm 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 zand3rs / sails-test-helper / bin / sails-test-helper.js View on Github external
function init() {
  prompt.colors = false;
  prompt.message = "";
  prompt.delimiter = "";
  prompt.start();

  var skelPath = path.join(__dirname, "..", "skel");
  var files = fs.readdirSync(skelPath);
  console.log("This will overwrite the ff. files and directories:", files);
  prompt.confirm("Do you want to continue?", function(err, ans) {
    if (ans) {
      fs.copySync(skelPath, ".");
      console.log("Done.");
    } else {
      console.log("Cancelled.");
    }
  });
}
github Azure / azure-xplat-cli / lib / util / interaction.js View on Github external
confirm: function (msg, callback) {
    checkNonInteractiveMode(msg);
    prompt_pkg.start();
    //surpress the default prompt message
    prompt_pkg.message = '';
    prompt_pkg.delimiter = '';
    prompt_pkg.confirm(msg, callback);
  },