inquirer-press-to-continue
v1.2.0
Published
A "press any key to continue" prompt for Inquirer.js
Downloads
11,285
Maintainers
Readme
inquirer-press-to-continue
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.