Permalink
Browse files

docs

  • Loading branch information...
tj committed Aug 14, 2011
1 parent 4988dd8 commit 1c281c613bb81833de5656c3e2026575d556d52e
Showing with 23 additions and 3 deletions.
  1. +0 −3 examples/confirm
  2. +23 −0 lib/commander.js
View
@@ -6,9 +6,6 @@
var program = require('../');
-program
- .parse(process.argv);
-
program.confirm('continue? ', function(ok){
console.log(' got %j', ok);
process.stdin.destroy();
View
@@ -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
@@ -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

0 comments on commit 1c281c6

Please sign in to comment.