1.0.7 • Published 11 months ago

nodejs-console-selector v1.0.7

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

node-js-console-selector

NodeJS Console Selector is an efficient and easy-to-use library for creating interactive console applications. With this library, you can offer users a selection of options directly from the command line.

Features

  • Simple API: Easy to integrate and use.
  • Customizable Prompts: Tailor prompts to fit your application's needs.
  • Key Navigation: Users can navigate options using keyboard keys.
  • Async/Await Support: Works seamlessly with modern JavaScript syntax.
  • TS Support: Fully compatible with TypeScript

Installation

Install via npm:

npm install nodejs-console-selector

Usage

Here’s a quick example to get you started with nodejs-console-selector:

import { list } from 'nodejs-console-selector';

(async () => {
    const choices = ['Option 1', 'Option 2', 'Option 3'];
    const selected = await list({
        message: 'Please select an option:',
        options: choices,
    });
    
    console.log(`You selected: ${selected}`);
    process.exit();
})();

Then type in your terminal

npx run ts-node path/to/your/file.ts

And how it works How it works

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

12 months ago

1.0.0

12 months ago