prompt-for
Advanced tools
Comparing version 0.2.0 to 0.3.0
0.3.0 - April 29, 2014 | ||
---------------------- | ||
* fix `pad` option | ||
* add `hint` to schema for custom hints | ||
0.2.0 - April 24, 2014 | ||
@@ -3,0 +8,0 @@ ---------------------- |
@@ -95,6 +95,11 @@ | ||
obj.required = !! obj.required; | ||
obj.label = obj.label || key; | ||
if (options.pad) obj.label = pad(obj.label, width); | ||
if ('boolean' == obj.type) obj.default = obj.default || false; | ||
if ('date' == obj.type) obj.default = obj.default || 'now'; | ||
if (obj.label) { | ||
if (options.pad) obj.label = ' ' + obj.label; | ||
} else { | ||
obj.label = key; | ||
if (options.pad) obj.label = pad(obj.label, width); | ||
} | ||
}); | ||
@@ -101,0 +106,0 @@ |
@@ -19,3 +19,3 @@ | ||
prompt(msg, fn); | ||
} | ||
}; | ||
@@ -33,3 +33,3 @@ /** | ||
prompt.password(msg, fn); | ||
} | ||
}; | ||
@@ -51,3 +51,3 @@ /** | ||
}); | ||
} | ||
}; | ||
@@ -68,3 +68,3 @@ /** | ||
}); | ||
} | ||
}; | ||
@@ -86,3 +86,3 @@ /** | ||
}); | ||
} | ||
}; | ||
@@ -100,3 +100,5 @@ /** | ||
var label = color in colors ? chalk[color](schema.label) : schema.label; | ||
return fmt('%s%s %s ', label, sep, hint(schema)); | ||
var help = hint(schema); | ||
var h = help ? chalk.gray(help) + ' ' : ''; | ||
return fmt('%s%s %s', label, sep, h); | ||
} | ||
@@ -112,2 +114,3 @@ | ||
function hint(schema){ | ||
if (schema.hint) return schema.hint; | ||
var def = schema.default; | ||
@@ -114,0 +117,0 @@ switch (schema.type) { |
@@ -5,3 +5,3 @@ { | ||
"repository": "git://github.com/segmentio/prompt-for.git", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "main": "lib/index.js", |
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
11260
299