Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Aug 14, 2011
1 parent 4988dd8 commit 1c281c6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
3 changes: 0 additions & 3 deletions examples/confirm
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

var program = require('../');

program
.parse(process.argv);

program.confirm('continue? ', function(ok){
console.log(' got %j', ok);
process.stdin.destroy();
Expand Down
23 changes: 23 additions & 0 deletions lib/commander.js
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,22 @@ Command.prototype.promptMultiLine = function(str, fn){
/**
* Prompt `str` and callback `fn(val)`
*
* Commander supports single-line and multi-line prompts.
* To issue a single-line prompt simply add white-space
* to the end of `str`, something like "name: ", whereas
* for a multi-line prompt omit this "description:".
*
*
* Examples:
*
* program.prompt('Username: ', function(name){
* console.log('hi %s', name);
* });
*
* program.prompt('Description:', function(desc){
* console.log('description was "%s"', desc.trim());
* });
*
* @param {String} str
* @param {Function} fn
* @api public
Expand All @@ -684,6 +700,13 @@ Command.prototype.prompt = function(str, fn){
/**
* Confirmation prompt with `str` and callback `fn(bool)`
*
* Examples:
*
* program.confirm('continue? ', function(ok){
* console.log(' got %j', ok);
* process.stdin.destroy();
* });
*
* @param {String} str
* @param {Function} fn
* @api public
Expand Down

0 comments on commit 1c281c6

Please sign in to comment.