1.0.7 • Published 1 year ago

nodejs-console-selector v1.0.7

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year 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

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago