diff options
Diffstat (limited to 'node_modules/prompt/examples/nested-properties-prompt.js')
-rw-r--r-- | node_modules/prompt/examples/nested-properties-prompt.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/node_modules/prompt/examples/nested-properties-prompt.js b/node_modules/prompt/examples/nested-properties-prompt.js new file mode 100644 index 0000000..25106a2 --- /dev/null +++ b/node_modules/prompt/examples/nested-properties-prompt.js @@ -0,0 +1,37 @@ +/* + * property-prompt.js: Example of using prompt with complex properties. + * + * (C) 2010, Nodejitsu Inc. + * + */ + +var prompt = require('../lib/prompt'); + +var schema = { + properties: { + url: { + required: true, + format: 'url' + }, + auth: { + properties: { + username: { + required: true + }, + password: { + required: true, + hidden: true + } + } + } + } +}; + +prompt.start(); + +prompt.get(schema, function (err, result) { + console.log('Command-line input received:'); + console.log(' url: ' + result.url); + console.log(' auth:username: ' + result.auth.username); + console.log(' auth:password: ' + result.auth.password); +}); |