Socket
Socket
Sign inDemoInstall

listr-input

Package Overview
Dependencies
35
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    listr-input

Input module for Listr


Version published
Weekly downloads
100K
decreased by-8.34%
Maintainers
1
Install size
7.51 MB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 17 Feb 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc