@rizzlesauce/inquirer-autocomplete-prompt
Advanced tools
Comparing version 1.0.2-rossa.4 to 1.0.2-rossa.5
17
index.js
@@ -38,2 +38,3 @@ // @flow | ||
this.paginator = new Paginator(); | ||
this.transformChoice = this.opt.transformChoice || (option => option); | ||
} | ||
@@ -93,3 +94,3 @@ | ||
} else if (this.currentChoices.length) { | ||
var choicesStr = listRender(this.currentChoices, this.selected); | ||
var choicesStr = listRender(this.currentChoices, this.selected, this.opt.styleSelected); | ||
content += this.rl.line; | ||
@@ -131,2 +132,5 @@ var indexPosition = this.selected; | ||
onSubmit(line /* : string */) { | ||
if (!this.opt.suggestOnly) { | ||
line = this.transformChoice(line); | ||
} | ||
if (typeof this.opt.validate === 'function' && this.opt.suggestOnly) { | ||
@@ -243,3 +247,4 @@ var validationResult = this.opt.validate(line); | ||
this.rl.clearLine(); | ||
var autoCompleted = this.currentChoices.getChoice(this.selected).value; | ||
var autoCompleted = this.transformChoice( | ||
this.currentChoices.getChoice(this.selected).value); | ||
this.rl.write(autoCompleted); | ||
@@ -277,3 +282,3 @@ this.render(); | ||
*/ | ||
function listRender(choices, pointer /*: string */) /*: string */ { | ||
function listRender(choices, pointer /*: string */, styleSelected /*: (text: string) => string */) /*: string */ { | ||
var output = ''; | ||
@@ -293,3 +298,7 @@ var separatorOffset = 0; | ||
if (isSelected) { | ||
line = chalk.cyan(line); | ||
if (styleSelected) { | ||
line = styleSelected(line); | ||
} else { | ||
line = chalk.cyan(line); | ||
} | ||
} | ||
@@ -296,0 +305,0 @@ output += line + ' \n'; |
{ | ||
"name": "@rizzlesauce/inquirer-autocomplete-prompt", | ||
"description": "Autocomplete prompt for inquirer", | ||
"version": "1.0.2-rossa.4", | ||
"version": "1.0.2-rossa.5", | ||
"files": [ | ||
@@ -6,0 +6,0 @@ "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
13642
263