Skip to content

Commit

Permalink
updated readme, bumped version
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Wilkowski <[email protected]>
  • Loading branch information
dominikwilkowski committed Apr 27, 2018
1 parent 32c7c60 commit ecd5a76
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 28 deletions.
40 changes: 17 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,14 @@
╚═════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝ ╚══════╝
```

[![NPM](https://nodei.co/npm/cfonts.png?downloads=true)](https://nodei.co/npm/cfonts/)


> This is a silly little command line tool for sexy fonts in the console. **Give your cli some love.**
## Examples

Different styles:

![cfont styles](https://raw.githubusercontent.com/dominikwilkowski/cfonts/master/img/example1.png)

Real world example:

![api example](https://raw.githubusercontent.com/dominikwilkowski/cfonts/master/img/example2.png)
<p align="center"><img src="https://raw.githubusercontent.com/dominikwilkowski/cfonts/master/img/example2.png" alt="api example"></p>
<p align="center"><a href="https://nodei.co/npm/cfonts/"><img src="https://nodei.co/npm/cfonts.png?downloads=true" alt="npm status"></a></p>
<p align="center"><a href="https://travis-ci.org/dominikwilkowski/cfonts"><img src="https://travis-ci.org/dominikwilkowski/cfonts.svg?branch=master" alt="build status"></a></p>

<p align="center">This is a silly little command line tool for sexy fonts in the console. <strong>Give your cli some love.</strong></p>

## Installing

Expand All @@ -45,14 +38,14 @@ Or use it in your project:
const CFonts = require('cfonts');

CFonts.say('Hello|world!', {
font: 'block', //define the font face
align: 'left', //define text alignment
colors: ['system'], //define all colors
background: 'transparent', //define the background color, you can also use `backgroundColor` here as key
letterSpacing: 1, //define letter spacing
lineHeight: 1, //define the line height
space: true, //define if the output text should have empty lines on top and on the bottom
maxLength: '0', //define how many character can be on one line
font: 'block', // define the font face
align: 'left', // define text alignment
colors: ['system'], // define all colors
background: 'transparent', // define the background color, you can also use `backgroundColor` here as key
letterSpacing: 1, // define letter spacing
lineHeight: 1, // define the line height
space: true, // define if the output text should have empty lines on top and on the bottom
maxLength: '0', // define how many character can be on one line
});
```

Expand All @@ -65,10 +58,10 @@ const CFonts = require('cfonts');

const prettyFont = CFonts.render('Hello|world!', {/* same settings object as above */});

prettyFont.string //the ansi string for sexy console font
prettyFont.array //returns the array for the output
prettyFont.lines //returns the lines used
prettyFont.options //returns the options used
prettyFont.string // the ansi string for sexy console font
prettyFont.array // returns the array for the output
prettyFont.lines // returns the lines used
prettyFont.options // returns the options used
```


Expand Down Expand Up @@ -380,6 +373,7 @@ npm run test


## Release History
* 2.1.0 - Rebuilt cfonts with pure functions, made colors case-insensitive
* 2.0.1 - Fixed terminal width detection
* 2.0.0 - Added tests, split into more pure functions
* 1.2.0 - Added `transparent` and `system` as default background and color option, added `backgroundColor` as alias for `background`, upgraded deps
Expand Down
Binary file modified img/example1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cfonts",
"description": "Sexy fonts for the console",
"version": "2.0.1",
"version": "2.1.0",
"homepage": "https://github.com/dominikwilkowski/cfonts",
"author": {
"name": "Dominik Wilkowski",
Expand Down
2 changes: 1 addition & 1 deletion src/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
// Dependencies
const CFonts = require('..');

CFonts.Cli();
CFonts.__test__.Cli();
5 changes: 3 additions & 2 deletions src/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -992,8 +992,8 @@ const DisplayHelp = () => {
let largestSize = 0;

Object.keys( CLIOPTIONS ).forEach( option => {
console.log( Chalk.bold( CLIOPTIONS[ option ].description ) );
console.log(`${ option }, ${ CLIOPTIONS[ option ].short }`);
console.log( Chalk.bold(`${ option }, ${ CLIOPTIONS[ option ].short }`) );
console.log( CLIOPTIONS[ option ].description );
console.log(`${ Chalk.bold('$') } cfonts ${ option }${
typeof CLIOPTIONS[ option ].options !== 'boolean' && typeof CLIOPTIONS[ option ].options !== 'undefined'
? Chalk.green(` ( ${ CLIOPTIONS[ option ].options.join(', ') } )`)
Expand Down Expand Up @@ -1052,6 +1052,7 @@ const Cli = ( inputOptions = CLIOPTIONS, inputArgs = process.argv ) => {
`Please provide text to convert with ${ Chalk.green(`cfonts "Text"`) }\n` +
`Run ${ Chalk.green(`cfonts --help`) } for more infos`
);
return;
}

Say( args.text, {
Expand Down
19 changes: 18 additions & 1 deletion test/unit/cli.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ const options = {
short: '-3',
default: false,
},
'--colors': {
description: 'desc colors',
short: '-c',
options: true,
default: 'system',
},
};


Expand All @@ -41,6 +47,17 @@ test(`CLI - Text should be outputted`, () => {
});


test(`CLI - Text should be outputted even when options are not given completely`, () => {
console.log = jest.fn();
console.error = jest.fn();

Cli( options, [ 'node', 'script', 'text', '-c' ] );

expect( console.log.mock.calls.length > 0 ).toBe( true );
expect( console.error.mock.calls.length === 0 ).toBe( true );
});


test(`CLI - Help should be outputted`, () => {
console.log = jest.fn();
console.error = jest.fn();
Expand All @@ -63,7 +80,7 @@ test(`CLI - Version should be outputted`, () => {
});


test(`CLI - Version should be outputted`, () => {
test(`CLI - Should error out when no text has been given`, () => {
console.log = jest.fn();
console.error = jest.fn();

Expand Down
11 changes: 11 additions & 0 deletions test/unit/debugging.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,14 @@ test(`Debugging - Don’t show message when debuglevel is too high`, () => {

expect( console.log.mock.calls.length ).toBe( 0 );
});


test(`Debugging - Debugging is off by default`, () => {
console.log = jest.fn();

Debugging.headline( 'text' );
Debugging.report( 'text' );
Debugging.error( 'text' );

expect( console.log.mock.calls.length ).toBe( 0 );
});

0 comments on commit ecd5a76

Please sign in to comment.