summaryrefslogtreecommitdiff
path: root/node_modules/prompt/examples/prompt-streamline._js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/prompt/examples/prompt-streamline._js')
-rw-r--r--node_modules/prompt/examples/prompt-streamline._js32
1 files changed, 32 insertions, 0 deletions
diff --git a/node_modules/prompt/examples/prompt-streamline._js b/node_modules/prompt/examples/prompt-streamline._js
new file mode 100644
index 0000000..e7fef42
--- /dev/null
+++ b/node_modules/prompt/examples/prompt-streamline._js
@@ -0,0 +1,32 @@
+/*
+ * prompt-streamline._js: Example of how to use prompt with streamlinejs.
+ *
+ * calling syntax: _node prompt-streamline._js
+ *
+ */
+var prompt = require('../lib/prompt');
+
+function getSampleData(){
+ return [
+ {
+ name: 'username',
+ message: 'Enter a username'
+ }
+ ];
+};
+
+//
+// Start the prompt
+//
+prompt.start();
+
+function get_username_prompt(_){
+ console.log(prompt.get(getSampleData(), _).username);
+}
+
+get_username_prompt(_);
+
+//
+// Clean the prompt
+//
+prompt.stop(); \ No newline at end of file