Comparing version 5.1.0 to 5.2.0
@@ -55,9 +55,5 @@ "use strict"; | ||
function _prompt(name, inputOptions = {}) { | ||
let prompt = '> '; | ||
if (name && inputOptions.default) | ||
prompt = name + ' ' + chalk_1.default.yellow('[' + inputOptions.default + ']') + ': '; | ||
else if (name) | ||
prompt = `${name}: `; | ||
const prompt = getPrompt(name, inputOptions.type, inputOptions.default); | ||
const options = Object.assign({ isTTY: !!(process.env.TERM !== 'dumb' && process.stdin.isTTY), name, | ||
prompt, type: 'normal', required: true }, inputOptions); | ||
prompt, type: 'normal', required: true, default: '' }, inputOptions); | ||
switch (options.type) { | ||
@@ -70,3 +66,7 @@ case 'normal': | ||
case 'hide': | ||
return deps_1.default.passwordPrompt(options.prompt, { method: options.type }); | ||
return deps_1.default.passwordPrompt(options.prompt, { | ||
method: options.type, | ||
required: options.required, | ||
default: options.default | ||
}); | ||
default: | ||
@@ -114,1 +114,12 @@ throw new Error(`unexpected type ${options.type}`); | ||
} | ||
function getPrompt(name, type, defaultValue) { | ||
let prompt = '> '; | ||
if (defaultValue && (type && type === 'mask' || type === 'hide')) { | ||
defaultValue = '*'.repeat(defaultValue.length); | ||
} | ||
if (name && defaultValue) | ||
prompt = name + ' ' + chalk_1.default.yellow('[' + defaultValue + ']') + ': '; | ||
else if (name) | ||
prompt = `${name}: `; | ||
return prompt; | ||
} |
{ | ||
"name": "cli-ux", | ||
"description": "cli IO utilities", | ||
"version": "5.1.0", | ||
"version": "5.2.0", | ||
"author": "Jeff Dickey @jdxcode", | ||
@@ -24,3 +24,3 @@ "bugs": "https://github.com/oclif/cli-ux/issues", | ||
"natural-orderby": "^1.0.2", | ||
"password-prompt": "^1.0.7", | ||
"password-prompt": "^1.1.0", | ||
"semver": "^5.6.0", | ||
@@ -27,0 +27,0 @@ "string-width": "^2.1.1", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
86015
1707
16
Updatedpassword-prompt@^1.1.0