Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
inquirer-list-search-prompt
Advanced tools
This is the fork of the mokkabonna's inquirer-autocomplete-prompt plugin.
This package fixes the issue with an empty string answer.
Autocomplete prompt for inquirer
npm install --save inquirer-autocomplete-prompt
This prompt is anonymous, meaning you can register this prompt with the type name you please:
inquirer.registerPrompt('autocomplete', require('inquirer-autocomplete-prompt'));
inquirer.prompt({
type: 'autocomplete',
...
})
Change autocomplete
to whatever you might prefer.
Note: allowed options written inside square brackets (
[]
) are optional. Others are required.
type
, name
, message
, source
[, pageSize
, filter
, when
, suggestOnly
, validate
]
See inquirer readme for meaning of all except source and suggestOnly.
Source will be called with previous answers object and the current user input each time the user types, it must return a promise.
Source will be called once at at first before the user types anything with undefined as the value. If a new search is triggered by user input it maintains the correct order, meaning that if the first call completes after the second starts, the results of the first call are never displayed.
suggestOnly is default false. Setting it to true turns the input into a normal text input. Meaning that pressing enter selects whatever value you currently have. And pressing tab autocompletes the currently selected value in the list. This way you can accept manual input instead of forcing a selection from the list.
validate is only active when suggestOnly is set to true. It behaves like validate for the input prompt.
inquirer.registerPrompt(
'autocomplete',
require('inquirer-autocomplete-prompt')
);
inquirer
.prompt([
{
type: 'autocomplete',
name: 'from',
message: 'Select a state to travel from',
source: function(answersSoFar, input) {
return myApi.searchStates(input);
},
},
])
.then(function(answers) {
//etc
});
See also example.js for a working example.
I recommend using this package with fuzzy if you want fuzzy search. Again, see the example for a demonstration of this.
Martin Hansen - the original creator
ISC
FAQs
Autocomplete prompt for inquirer
The npm package inquirer-list-search-prompt receives a total of 142 weekly downloads. As such, inquirer-list-search-prompt popularity was classified as not popular.
We found that inquirer-list-search-prompt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.