inquirer-press-to-continue
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

inquirer-press-to-continue

npm version

Installation

Make sure you have inquirer installed:

npm install inquirer

Then, install inquirer-press-to-continue:

npm install inquirer-press-to-continue

Usage

import inquirer from 'inquirer';
import PressToContinuePrompt from 'inquirer-press-to-continue';
import type { KeyDescriptor } from 'inquirer-press-to-continue';

inquirer.registerPrompt('press-to-continue', PressToContinuePrompt);

const { key: enterKey } = await inquirer.prompt<{ key: KeyDescriptor }>({
  name: 'key',
  type: 'press-to-continue',
  enter: true,
});

console.log(enterKey.value); // "enter"

const { key: anyKey } = await inquirer.prompt<{ key: KeyDescriptor }>({
  name: 'key',
  type: 'press-to-continue',
  anyKey: true,
  pressToContinueMessage: 'Press a key to continue...',
});

console.log(anyKey.value);

API

key

Type: string

The key the user should press to continue.

anyKey

Type: boolean

Whether to allow the user to press any key to continue.

enter

Type: boolean

Only allow the enter key to be pressed.

pressToContinueMessage

Type: string

Custom message for prompting the user to press a key to continue.

Package Sidebar

Install

npm i inquirer-press-to-continue

Weekly Downloads

3,158

Version

1.2.0

License

MIT

Unpacked Size

797 kB

Total Files

11

Last publish

Collaborators

  • leonsilicon