@xandrrrr/prompt-kit
TypeScript icon, indicating that this package has built-in type declarations

2.0.4 • Public • Published

Prompt Kit

Build interactive command line interfaces with ease. This package only works in a TTY-enabled environment. If the package is used in a non-TTY environment, it will print a warning that can be suppressed by setting the PROMPTKIT_DISABLE_TTY_WARNING environment variable to true.

Installation

To install the latest version, run:

npm install prompt-kit

Usage

const { SelectionBuilder } = require('prompt-kit');

const selection = new SelectionBuilder()
  .setPrompt('Select a color')
  .setOptions([
    { option: 'red', value: 'red' },
    { option: 'green', value: 'green' },
    { option: 'blue', value: 'blue' },
  ])
  .build()
  .then((selected) => {
    console.log(`You selected ${selected.map((s) => s.value).join(', ')}`);
  });

Documentation

You can find the documentation here.

Package Sidebar

Install

npm i @xandrrrr/prompt-kit

Weekly Downloads

0

Version

2.0.4

License

MIT

Unpacked Size

132 kB

Total Files

107

Last publish

Collaborators

  • xandrrrr