prompt-for
Advanced tools
Comparing version 1.0.0 to 1.1.0
1.1.0 - March 29, 2015 | ||
---------------------- | ||
* add `prefix` option | ||
* swap to `read` for prompting | ||
1.0.0 - March 28, 2015 | ||
@@ -3,0 +8,0 @@ ---------------------- |
@@ -5,3 +5,3 @@ | ||
var fmt = require('util').format; | ||
var prompt = require('cli-prompt'); | ||
var read = require('read'); | ||
var colors = chalk.styles; | ||
@@ -19,3 +19,4 @@ | ||
var msg = format(schema, options); | ||
prompt(msg, function(val){ | ||
read({ prompt: msg }, function(err, val){ | ||
if (err) return fn(); | ||
if ('' === val && schema.required) return fn(); | ||
@@ -36,3 +37,4 @@ return fn(val); | ||
var msg = format(schema, options); | ||
prompt.password(msg, function(val){ | ||
read({ prompt: msg, silent: true }, function(err, val){ | ||
if (err) return fn([]); | ||
if ('' === val && schema.required) return fn(); | ||
@@ -53,3 +55,4 @@ return fn(val); | ||
var msg = format(schema, options); | ||
prompt(msg, function(val){ | ||
read({ prompt: msg }, function(err, val){ | ||
if (err) return fn([]); | ||
val = parseFloat(val, 10); | ||
@@ -71,3 +74,4 @@ if (isNaN(val)) return fn(); | ||
var msg = format(schema, options); | ||
prompt(msg, function(val){ | ||
read({ prompt: msg }, function(err, val){ | ||
if (err) return fn([]); | ||
if ('' == val) return fn(); | ||
@@ -88,3 +92,4 @@ fn(/^(y|yes|true)$/i.test(val)); | ||
var msg = format(schema, options); | ||
prompt(msg, function(val){ | ||
read({ prompt: msg }, function(err, val){ | ||
if (err) return fn([]); | ||
var ret = new Date(val); | ||
@@ -106,3 +111,4 @@ if (invalid(ret)) ret = date(val); | ||
var msg = format(schema, options); | ||
prompt(msg, function(val){ | ||
read({ prompt: msg }, function(err, val){ | ||
if (err) return fn([]); | ||
var ret = val.split(/ *, */g); | ||
@@ -124,6 +130,7 @@ if (!(ret instanceof Array)) ret = []; | ||
var sep = options.separator || ':'; | ||
var prefix = options.prefix || ''; | ||
var label = color in colors ? chalk[color](schema.label) : schema.label; | ||
var help = hint(schema); | ||
var h = help ? chalk.gray(help) + ' ' : ''; | ||
return fmt('%s%s %s', label, sep, h); | ||
return fmt('%s%s %s', prefix, label, sep, h); | ||
} | ||
@@ -130,0 +137,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"repository": "git://github.com/segmentio/prompt-for.git", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"license": "MIT", | ||
@@ -18,3 +18,4 @@ "main": "lib/index.js", | ||
"max-component": "^1.0.0", | ||
"pad-component": "0.0.1" | ||
"pad-component": "0.0.1", | ||
"read": "^1.0.5" | ||
}, | ||
@@ -21,0 +22,0 @@ "devDependencies": { |
@@ -99,3 +99,5 @@ | ||
color: null, | ||
pad: true | ||
pad: true, | ||
prefix: '', | ||
separator: ': ' | ||
} | ||
@@ -102,0 +104,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13179
339
106
10
+ Addedread@^1.0.5
+ Addedmute-stream@0.0.8(transitive)
+ Addedread@1.0.7(transitive)