0.8.0 • Published 2 years ago

cli-classy v0.8.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Sudo-Nymd

Stylish CLI. Classy.

Add color and style to your console output -- the classy way.

Before (The Déclassé Way)

You've styled out your terminal -- bravo, by the way. While coding, you notice your console output looks underdressed... No style... déclassé!

You import your favorite colors library and begin bending over backward with string interpolation, and now your console code is a twisted, spaghetti mess...

You're trying too hard and that's just not classy.

Before

After (The New, Classy Way)

After

Path to Terminal Style and Eternal Classiness

1. Add the cli-classy library to your project.

npm i cli-classy

2. Import cli-classy into your module.

If using TypeScript, use the following import statements at the top of your .ts file:

import { Stylesheet, TokenFlags } from 'cli-classy';

// Pull style functions from your preferred color lib
import * as colors from 'ansi-colors';

If using JavaScript, use the following require statements at the top of your .js file:

const { Stylesheet, TokenFlags } = require('cli-classy');

// Pull style functions from your preferred color lib
const colors = require('ansi-colors');

3. Create a stylesheet. Getting Classier

const classyfy = new Stylesheet()
    .addStyle(TokenFlags.Braced, colors.greenBright)
    .addStyle(TokenFlags.Bracketed, colors.blueBright)
    .addStyle(TokenFlags.Punctuation, colors.cyan)
    .addStyle(TokenFlags.Quoted, colors.bgCyanBright.blue)
    .apply();

4. Run your text (with tokens) through the stylesheet.

console.log(classyfy("The quick [brown] fox jumped over the 'lazy dog', and the {cow} jumped over the moon! Enough said."));

5. Bask in the glow of colorful console output... the easy (and, classy!) way.

After

How it Works

Not yet, but coming soon.

Extending with Your Own Style Functions

Not yet, but coming soon.

0.8.0

2 years ago

0.7.15

2 years ago

0.9.15

2 years ago

0.9.14

2 years ago

0.9.13

2 years ago

0.9.12

2 years ago

0.9.11

2 years ago

0.9.10

2 years ago

0.9.9

2 years ago

0.9.8

2 years ago

0.9.7

2 years ago

0.9.6

2 years ago

0.9.5

2 years ago

0.9.4

2 years ago

0.9.3

2 years ago