/press-enter

BBS-style ANSI color enter prompts for Node.js modules or the CLI

Primary LanguageJavaScript

press-enter

BBS-style ANSI color enter prompts for Node.js modules or the CLI

image

There are 9 animated prompts and 6 static prompts.

The animated prompts were ported from an old PCBoard PPE (EPE1PWA.ZIP) originally released on February 17, 1994, a little over twenty years ago.

image

The static prompts were extracted from the default install of Iniquity BBS software v1.01, released on July 26, 1997.

image

Here's are the prompts in use in their corresponding software:

Animated prompt in PCBoard

image

Static prompt in Iniquity

image

Static prompts:

image

Installation

npm install -g press-enter

Usage

To use press-enter, your terminal must support ANSI colors with bright settings. I use iTerm2 with the Report Terminal Type setting at xterm-256color and colors set to the Dark Background preset.

CLI usage

press-enter [style] [color]
  style: 0-13
  color: red, yellow, green, blue, cyan, magenta, grey

For example, if you want to use the 4th prompt in Red, you can type

press-enter 4 red

or specify that in your shell scripts.

0-8 are animated prompts, 9-13 are static.

Running press-enter by itself will default to the 3rd style in the color blue.

Node usage

You can use press-enter anywhere where you want to control flow. The callback fires after the user presses enter.

pressEnter([options], callback)

Options is an optional hash, you can omit it:

var pressEnter = require('press-enter');

pressEnter(function() {
	process.exit();
});
Option Description
style Style from 0-13, 0-8 are animated, 9-13 are static
color red, yellow, green, blue, cyan, magenta, grey. Defaults to blue.
centered Whether or not to try to detect the number of columns in the terminal and center the prompt. Defaults to true.
input Node.js stream, defaults to stdin
output Node.js stream, defaults to stdout

Example specifying options:

var pressEnter = require('press-enter');

pressEnter({style: 3, color: red}, function() {
	process.exit();
});

License

MIT