Socket
Socket
Sign inDemoInstall

cli-boxes

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cli-boxes

Boxes for use in the terminal


Version published
Weekly downloads
12M
increased by0.47%
Maintainers
1
Install size
7.47 kB
Created
Weekly downloads
 

Package description

What is cli-boxes?

The cli-boxes package provides a collection of predefined box styles for use in command-line interfaces. It allows developers to easily add boxes around text in the terminal for improved readability and aesthetic appeal.

What are cli-boxes's main functionalities?

Predefined box styles

cli-boxes comes with a set of predefined box styles that can be used to wrap around text. The above code sample logs the 'single' box style to the console.

const cliBoxes = require('cli-boxes');
console.log(cliBoxes.single);

Customizable boxes

Developers can use the predefined box styles to create customizable boxes around their text. The code sample demonstrates how to create a box with padding around the text 'Hello, World!'.

const cliBoxes = require('cli-boxes');
const box = cliBoxes.single;
const text = 'Hello, World!';
const padding = 1;
const lines = text.split('\n');
const maxLength = Math.max(...lines.map(line => line.length));
const top = box.topLeft + box.horizontal.repeat(maxLength + padding * 2) + box.topRight;
const bottom = box.bottomLeft + box.horizontal.repeat(maxLength + padding * 2) + box.bottomRight;
const side = box.vertical;
console.log(top);
lines.forEach(line => {
  const paddingLeft = ' '.repeat(padding);
  const paddingRight = ' '.repeat(maxLength - line.length + padding);
  console.log(side + paddingLeft + line + paddingRight + side);
});
console.log(bottom);

Other packages similar to cli-boxes

Readme

Source

cli-boxes

Boxes for use in the terminal

The list of boxes is just a JSON file and can be used anywhere.

Install

$ npm install cli-boxes

Usage

const cliBoxes = require('cli-boxes');

console.log(cliBoxes.single);
/*
{
	topLeft: '┌',
	top: '─',
	topRight: '┐',
	right: '│',
	bottomRight: '┘',
	bottom: '─',
	bottomLeft: '└',
	left: '│'
}
*/

API

cliBoxes

single
┌────┐
│    │
└────┘
double
╔════╗
║    ║
╚════╝
round
╭────╮
│    │
╰────╯
bold
┏━━━━┓
┃    ┃
┗━━━━┛
singleDouble
╓────╖
║    ║
╙────╜
doubleSingle
╒════╕
│    │
╘════╛
classic
+----+
|    |
+----+
arrow
↘↓↓↓↓↙
→    ←
↗↑↑↑↑↖
  • boxen - Create boxes in the terminal

Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Keywords

FAQs

Last updated on 16 Jan 2021

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc