Permalink
Browse files

remove input methods (.prompt, .confirm, etc)

they belong in a different library
  • Loading branch information...
1 parent bf22882 commit bf5e1f5ec9fb1af23dd873117558575cd01d7415 @tj committed Jul 19, 2013
Showing with 7 additions and 492 deletions.
  1. +0 −81 Readme.md
  2. +0 −16 examples/bulk-input
  3. +0 −20 examples/choice
  4. +0 −12 examples/confirm
  5. +0 −24 examples/input
  6. +0 −18 examples/password
  7. +7 −320 index.js
  8. +0 −1 package.json
View
@@ -153,87 +153,6 @@ Examples:
```
-## .prompt(msg, fn)
-
- Single-line prompt:
-
-```js
-program.prompt('name: ', function(name){
- console.log('hi %s', name);
-});
-```
-
- Multi-line prompt:
-
-```js
-program.prompt('description:', function(name){
- console.log('hi %s', name);
-});
-```
-
- Coercion:
-
-```js
-program.prompt('Age: ', Number, function(age){
- console.log('age: %j', age);
-});
-```
-
-```js
-program.prompt('Birthdate: ', Date, function(date){
- console.log('date: %s', date);
-});
-```
-
-```js
-program.prompt('Email: ', /^.+@.+\..+$/, function(email){
- console.log('email: %j', email);
-});
-```
-
-## .password(msg[, mask], fn)
-
-Prompt for password without echoing:
-
-```js
-program.password('Password: ', function(pass){
- console.log('got "%s"', pass);
- process.stdin.destroy();
-});
-```
-
-Prompt for password with mask char "*":
-
-```js
-program.password('Password: ', '*', function(pass){
- console.log('got "%s"', pass);
- process.stdin.destroy();
-});
-```
-
-## .confirm(msg, fn)
-
- Confirm with the given `msg`:
-
-```js
-program.confirm('continue? ', function(ok){
- console.log(' got %j', ok);
-});
-```
-
-## .choose(list, fn)
-
- Let the user choose from a `list`:
-
-```js
-var list = ['tobi', 'loki', 'jane', 'manny', 'luna'];
-
-console.log('Choose the coolest pet:');
-program.choose(list, function(i){
- console.log('you chose %d "%s"', i, list[i]);
-});
-```
-
## .outputHelp()
Output help information without exiting.
View
@@ -1,16 +0,0 @@
-#!/usr/bin/env node
-
-/**
- * Module dependencies.
- */
-
-var program = require('../');
-
-program.prompt({
- name: 'Username: ',
- desc: 'Description:',
- age: 'Age: '
-}, function(obj){
- console.log(obj);
- process.stdin.destroy();
-});
View
@@ -1,20 +0,0 @@
-#!/usr/bin/env node
-
-/**
- * Module dependencies.
- */
-
-var program = require('../');
-
-var list = ['tobi', 'loki', 'jane', 'manny', 'luna'];
-
-console.log('Choose the coolest pet:');
-program.choose(list, function(i){
- console.log('you chose %d "%s"', i+1, list[i]);
- console.log();
- console.log('Choose the coolest pet, defaulting to loki:');
- program.choose(list, 1, function(i){
- console.log('you chose %d "%s"', i+1, list[i]);
- process.stdin.destroy();
- });
-});
View
@@ -1,12 +0,0 @@
-#!/usr/bin/env node
-
-/**
- * Module dependencies.
- */
-
-var program = require('../');
-
-program.confirm('continue? ', function(ok){
- console.log(' got %j', ok);
- process.stdin.destroy();
-});
View
@@ -1,24 +0,0 @@
-#!/usr/bin/env node
-
-/**
- * Module dependencies.
- */
-
-var program = require('../');
-
-program.prompt('Username: ', function(name){
- console.log('hi %s\n', name);
-
- program.prompt('Description:', function(desc){
- console.log('description was "%s"', desc.trim());
-
- program.prompt('Age: ', Number, function(age){
- console.log('age: %j\n', age);
-
- program.prompt('Birthdate: ', Date, function(date){
- console.log('date: %s\n', date);
- process.stdin.destroy();
- });
- });
- });
-});
View
@@ -1,18 +0,0 @@
-#!/usr/bin/env node
-
-/**
- * Module dependencies.
- */
-
-var program = require('../');
-
-program.password('Password: ', function(pass){
- console.log('got "%s"', pass);
- program.password('Password: ', '*', function(pass){
- console.log('got "%s"', pass);
- program.password('Password: ', '-', function(pass){
- console.log('got "%s"', pass);
- process.stdin.destroy();
- });
- });
-});
Oops, something went wrong.

3 comments on commit bf5e1f5

bibig commented on bf5e1f5 Aug 26, 2013

why removed them?

bibig see the note: "they belong in a different library".

Try using https://github.com/flatiron/prompt (or https://github.com/visionmedia/co-prompt if you are running node 0.11.x with access to generators).

ok, i got.
i miss the note.
thanks a lot :)

Please sign in to comment.