JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 196509
  • Score
    100M100P100Q165223F
  • License MIT

Input module for Listr

Package Exports

  • listr-input

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (listr-input) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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