Skip to main content

Terminal utilities

API Tooling

A collection of utilities for managing and interacting with a terminal.

Installation

yarn add @boost/terminal

There are many terminal based libraries and utilities available in the npm ecosystem, many of which Boost consolidates into a single package. The currently supported are as follows.

Cursor

The cursor object provides a set of ANSI escapes codes for use in manipulating the terminal cursor.

import { cursor } from '@boost/terminal';

process.stdout.write(cursor.to(10, 10));

Figures

The figures object provides a set of cross-platform symbols. View the official npm package for a full list.

import { figures } from '@boost/terminal';

process.stdout.write(figures.tick);

Screen

The screen object provides a set of ANSI escapes codes for use in manipulating the terminal screen.

import { screen } from '@boost/terminal';

process.stdout.write(screen.eraseLine);

Styles

The style export is an instance of chalk, for use in simple color and text styling.

import { style } from '@boost/terminal';

const pass = style.bgGreen.black.bold(' PASS ');

Text

A handful of functions can be used to operate on ANSI-aware strings. View the API for a full list of functions.

import { calculateWidth } from '@boost/terminal';

calculateWidth('古'); // 2