# inquirer-autocomplete-prompt-ipt

> Inquirer autocomplete prompt fork, optimized for ipt

Latest version **2.0.0** (published 2019-10-22) · ISC license · 0 weekly downloads

## Install

```sh
npm install inquirer-autocomplete-prompt-ipt
pnpm add inquirer-autocomplete-prompt-ipt
yarn add inquirer-autocomplete-prompt-ipt
bun add inquirer-autocomplete-prompt-ipt
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2019-10-22 |
| First published | 2017-11-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 5 |
| Unpacked size | 12.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Martin Hansen |
| Maintainers | ruyadorno |

## Links

- npm: https://www.npmjs.com/package/inquirer-autocomplete-prompt-ipt
- Repository: https://github.com/ruyadorno/inquirer-autocomplete-prompt
- Homepage: https://github.com/ruyadorno/inquirer-autocomplete-prompt#readme
- Issues: https://github.com/ruyadorno/inquirer-autocomplete-prompt/issues
- npm.io page: https://npm.io/package/inquirer-autocomplete-prompt-ipt

## Dependencies (5)

- [rxjs](https://npm.io/package/rxjs.md) ^6.5.3
- [chalk](https://npm.io/package/chalk.md) ^2.4.2
- [figures](https://npm.io/package/figures.md) ^3.1.0
- [run-async](https://npm.io/package/run-async.md) ^2.3.0
- [ansi-escapes](https://npm.io/package/ansi-escapes.md) ^4.2.1

## Recent versions

- 2.0.0 (latest) — 2019-10-22
- 1.0.1 — 2017-11-01
- 1.0.0 — 2017-11-01

## README

# inquirer-autocomplete-prompt-ipt

Autocomplete prompt for [inquirer](https://github.com/SBoudrias/Inquirer.js) fork, optimized for [iPipeTo](https://github.com/ruyadorno/ipt).

[![build status](https://secure.travis-ci.org/ruyadorno/inquirer-autocomplete-prompt.svg)](http://travis-ci.org/ruyadorno/inquirer-autocomplete-prompt)

## :warning: Important info about this fork

This is an attempt to keep a better maintained fork of **inquirer-autocomplete-prompt** since it's an important dependency of [iPipeTo](https://github.com/ruyadorno/ipt) and I do care about having nested dependencies up to date.

Published versions of this fork can be find at [inquirer-autocomplete-prompt-ipt](https://www.npmjs.com/package/inquirer-autocomplete-prompt-ipt) package in **npm**. e.g: `npm install inquirer-autocomplete-prompt-ipt` if you want to use it :blush:

<br />

## Usage


This prompt is anonymous, meaning you can register this prompt with the type name you please:

```javascript
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`[, `pageSize`, `filter`, `when`, `suggestOnly`, `validate`]

See [inquirer](https://github.com/SBoudrias/Inquirer.js) 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.


#### Example

```javascript
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](https://github.com/mokkabonna/inquirer-autocomplete-prompt/blob/master/example.js) for a working example.

I recommend using this package with [fuzzy](https://www.npmjs.com/package/fuzzy) if you want fuzzy search. Again, see the example for a demonstration of this.

![Autocomplete prompt](./inquirer.gif)

## Credits
[Martin Hansen](https://github.com/mokkabonna/)

## License

ISC

---
_Source: https://npm.io/package/inquirer-autocomplete-prompt-ipt · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
