From 20204baf1807825af4798ad03bfb329e4da05bc5 Mon Sep 17 00:00:00 2001 From: Minteck Date: Tue, 21 Dec 2021 16:50:49 +0100 Subject: Commit --- node_modules/prompt/examples/yes-or-no-prompt.js | 32 ++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 node_modules/prompt/examples/yes-or-no-prompt.js (limited to 'node_modules/prompt/examples/yes-or-no-prompt.js') diff --git a/node_modules/prompt/examples/yes-or-no-prompt.js b/node_modules/prompt/examples/yes-or-no-prompt.js new file mode 100644 index 0000000..512b556 --- /dev/null +++ b/node_modules/prompt/examples/yes-or-no-prompt.js @@ -0,0 +1,32 @@ +/* + * yes-or-no-prompt.js: Simple example of using prompt. + * + * (C) 2012, Nodejitsu Inc. + * + */ + +var prompt = require('../lib/prompt'); + +// +// Start the prompt +// +prompt.start(); + +var property = { + name: 'yesno', + message: 'are you sure?', + validator: /y[es]*|n[o]?/, + warning: 'Must respond yes or no', + default: 'no' +}; + +// +// Get the simple yes or no property +// +prompt.get(property, function (err, result) { + // + // Log the results. + // + console.log('Command-line input received:'); + console.log(' result: ' + result.yesno); +}); \ No newline at end of file -- cgit