0.0.4 • Published 9 years ago
tuck v0.0.4
~ tuck ~
┌─────────────────────────────┐
│ tuck your text into a box │
└─────────────────────────────┘
Install
$ npm install --save tuck
Usage
var tuck = require("tuck");
console.log(tuck(["Hi There", "This is how we tuck text into a box"]));
output
┌─────────────────────────────────────┐
│ Hi There │
│ This is how we tuck text into a box │
└─────────────────────────────────────┘
You can also configure the output:
var tuck = require("tuck");
console.log(tuck([
"",
"Hello",
"───",
"World",
""
], {
color: "yellow", // the color of the box (default: no color)
wall: "*", // the border of the box (default: the rectangle showed above)
padding: 3, // the padding of the box (default: 1)
center: true, // position of the box, will float left if false (default: false)
textCenter: true // position of the text, will float left if false (default: true)
}));
output
*************
* *
* Hello *
* ─── *
* World *
* * (the borders are yellow)
************* (trust me)
If you want to stylize the text in the box, use perfume syntax:
var tuck = require("tuck");
console.log(tuck([
"Here are some (blue text):blue",
"And here are some (red bold text):red:bold",
], {
color: "yellow",
textCenter: false
}));
output
┌─────────────────────────────────┐
│ Here are some blue text │
│ And here are some red bold text │
└─────────────────────────────────┘ (they are styled, trust me)
CLI
Install by running npm install --global tuck
(this is just for fun)
usage
tuck <text> [option]
options
--color
set the color of the box (this should be the first flag)
--center
set the position of the box
set the color of the box
Example
$ tuck 'Hello (World):red' --yellow --center