Input module for Listr
npm install listr-input> Input module for Listr
```
$ npm install --save listr-input
`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();
`
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: booleanfalse
Default:
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.
MIT © Sam Verschueren