Skip to content

Xander1233/prompt-kit

Repository files navigation

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 @xandrrrr/prompt-kit

Usage

const { SelectionBuilder } = require('@xandrrrr/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.

About

Build complex terminal interfaces and menues

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published