New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

simple-terminal

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-terminal

a module for rendering a simple console with user input. Useful for text games and basic text applications.

latest
npmnpm
Version
1.0.7
Version published
Maintainers
1
Created
Source

API

Simple Terminal is a module aimed at allowing users to quickly begin building basic terminal applications in node such as text games or CLI utilities.

It's built to intercept and relay keypresses using the input-handler module. And is built to be an automated module. You can technically manually render but it's not recommended.

You can instantiate a terminal as follows:

// You'll only need these two lines if you want to semi-manually render the terminal.
let simpleTerminal = require('simple-terminal');
let terminal = new simpleTerminal();

// If you want this to be handled automatically you can add this line.
// By default it will rely on input-handler to intercept keypresses.
terminal.automate();

For interfacing with the terminal you have the collowing options:

// You can intercept extraneous keypresses.
terminal.on('keypress', (key) => {
	terminal.print(`Key "${key.name}" was pressed`);
});

// You can intercept typed user input
terminal.on('inputSent', (query) => {
	terminal.print (`User typed: "${query.input}"`)
})

// You can intercept when the terminal is ready for use.
terminal.on('ready', () => {
	terminal.print('Ready!');
})

// You can push new messages to the terminal, like this
terminal.print('Hello, World!');

// You can manually force the terminal to render.
terminal.render();

FAQs

Package last updated on 28 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts