listr-input
Input module for Listr
Last updated 7 years ago by samverschueren .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install listr-input 
SYNC missed versions from official npm registry.

listr-input Build Status

Input module for Listr

Install

$ npm install --save listr-input

Usage

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
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

Current Tags

  • 0.2.1                                ...           latest (5 years ago)
  • 0.1.1                                ...           [object Object] (7 years ago)

6 Versions

  • 0.2.1                                ...           5 years ago
  • 0.2.0                                ...           5 years ago
  • 0.1.3                                ...           7 years ago
  • 0.1.2                                ...           7 years ago
  • 0.1.1                                ...           7 years ago
  • 0.1.0                                ...           7 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (2)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |