# listr-input

> Input module for Listr

Latest version **0.2.1** (published 2020-02-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install listr-input
pnpm add listr-input
yarn add listr-input
bun add listr-input
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2020-02-17 |
| First published | 2017-11-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 4 |
| Unpacked size | 4.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Sam Verschueren |
| Maintainers | samverschueren |
| Keywords | listr, input, question, message |

## Links

- npm: https://www.npmjs.com/package/listr-input
- Repository: https://github.com/SamVerschueren/listr-input
- Homepage: https://github.com/SamVerschueren/listr-input#readme
- Issues: https://github.com/SamVerschueren/listr-input/issues
- npm.io page: https://npm.io/package/listr-input

## Dependencies (4)

- [rxjs](https://npm.io/package/rxjs.md) ^6.5.3
- [through](https://npm.io/package/through.md) ^2.3.8
- [inquirer](https://npm.io/package/inquirer.md) ^7.0.0
- [inquirer-autosubmit-prompt](https://npm.io/package/inquirer-autosubmit-prompt.md) ^0.2.0

## Recent versions

- 0.2.1 (latest) — 2020-02-17
- 0.1.1 ([object Object]) — 2017-11-10
- 0.2.0 — 2019-09-30
- 0.1.3 — 2018-02-17
- 0.1.2 — 2017-11-10
- 0.1.0 — 2017-11-09

## README

# listr-input [![Build Status](https://travis-ci.org/SamVerschueren/listr-input.svg?branch=master)](https://travis-ci.org/SamVerschueren/listr-input)

> Input module for [Listr](https://github.com/SamVerschueren/listr)


## Install

```
$ npm install --save listr-input
```


## Usage

```js
const Listr = require('listr');
const input = require('listr-input');
const got = require('got');

const list = new Listr([
	{
		title: 'Retrieving data',
		task: () => input('Credentials', {
			secret: true,
			validate: value => value.length > 0,
			done: credentials => got('https://myapi.com', {
				headers: {
					'Authorization': `Bearer ${credentials}`
				}
			})
		})
	}
]);

list.run();
```


## API

### input(question, [options])

Returns an Observable which asks for user input.

#### question

Type: `string`

Question to ask.

#### options

##### default

Type: `string`

Default value to use if nothing is entered.

##### validate

Type: `function`

Function which accepts the provided value. Should return `true` if the value is valid, `false` otherwise.

##### secret

Type: `boolean`<br>
Default: `false`

Mark the input as secret.

##### done

Type: `function`

Function that will be invoked when the user has answered the question.

##### autoSubmit

Type: `function`

Function which accepts the provided value. If returns `true` then the value will be submitted automatically.



## License

MIT © [Sam Verschueren](https://github.com/SamVerschueren)

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