Package Exports
- inquirer-autocomplete-prompt
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (inquirer-autocomplete-prompt) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
inquirer-autocomplete-prompt
Autocomplete prompt for inquirer
Installation
npm install --save inquirer-autocomplete-prompt
Usage
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.
Options
Note: allowed options written inside square brackets (
[]
) are optional. Others are required.
type
, name
, message
, source
[, filter
, when
]
See inquirer readme for meaning of all except source.
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 a empty search string. 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.
Example
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);
}
}], function(answers) {
//etc
});
See also example.js for a working example
Credits
License
ISC