Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikwilkowski committed Jun 30, 2016
2 parents 17c3169 + afd3513 commit ac210b3
Show file tree
Hide file tree
Showing 11 changed files with 1,508 additions and 475 deletions.
27 changes: 16 additions & 11 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,27 @@ module.exports = function(grunt) {
// TEST
//----------------------------------------------------------------------------------------------------------------------------------------------------------
exec: {
test01: 'cfonts -t "a b c defghijklmnopqrstuvwxyz|0123456789|\!?.+-_=@#$%&()/:;ü"',
test02: 'cfonts -t "a b c defghijklmnopqrstuvwxyz|0123456789|\!?.+-_=@#$%&()/:;ü" -c red,magenta -m 15',
test01: 'cfonts "a b c defghijklmnopqrstuvwxyz0123456789\!?.+-_=@#$%&()/:;ü"',
test02: 'cfonts "a b c defghijklmnopqrstuvwxyz0123456789\!?.+-_=@#$%&()/:;ü" -c red,magenta -m 15',

test03: 'cfonts -t "a b c defghijklmnopqrstuvwxyz|0123456789|\!?.+-_=@#$%&()/:;ü" -f "simple"',
test04: 'cfonts -t "a b c defghijklmnopqrstuvwxyz|0123456789|\!?.+-_=@#$%&()/:;ü" -f "simple" -c yellow -m 20',
test03: 'cfonts "a b c defghijklmnopqrstuvwxyz0123456789\!?.+-_=@#$%&()/:;ü" -f "simple"',
test04: 'cfonts "a b c defghijklmnopqrstuvwxyz0123456789\!?.+-_=@#$%&()/:;ü" -f "simple" -c yellow -m 20',

test05: 'cfonts -t "a b c defghijklmnopqrstuvwxyz|0123456789|\!?.+-_=@#$%&()/:;ü" -f "3d"',
test06: 'cfonts -t "a b c defghijklmnopqrstuvwxyz|0123456789|\!?.+-_=@#$%&()/:;ü" -f "3d" -c magenta,yellow -m 7',
test05: 'cfonts "a b c defghijklmnopqrstuvwxyz0123456789\!?.+-_=@#$%&()/:;ü" -f "3d"',
test06: 'cfonts "a b c defghijklmnopqrstuvwxyz0123456789\!?.+-_=@#$%&()/:;ü" -f "3d" -c magenta,yellow -m 7',

test07: 'cfonts -t "a b c defghijklmnopqrstuvwxyz|0123456789|\!?.+-_=@#$%&()/:;ü" -f "console"',
test08: 'cfonts -t "a b c defghijklmnopqrstuvwxyz|0123456789|\!?.+-_=@#$%&()/:;ü" -f "console" -c blue -b white',
test07: 'cfonts "a b c defghijklmnopqrstuvwxyz0123456789\!?.+-_=@#$%&()/:;ü" -f "console"',
test08: 'cfonts "a b c defghijklmnopqrstuvwxyz0123456789\!?.+-_=@#$%&()/:;ü" -f "console" -c blue -b white',

test09: 'cfonts -t "a b c defghijklmnopqrstuvwxyz|0123456789|\!?.+-_=@#$%&()/:;ü" -f "simple3d"',
test10: 'cfonts -t "a b c defghijklmnopqrstuvwxyz|0123456789|\!?.+-_=@#$%&()/:;ü" -f "simple3d" -c cyan -b white',
},
test09: 'cfonts "a b c defghijklmnopqrstuvwxyz0123456789\!?.+-_=@#$%&()/:;ü" -f "simple3d"',
test10: 'cfonts "a b c defghijklmnopqrstuvwxyz0123456789\!?.+-_=@#$%&()/:;ü" -f "simple3d" -c cyan -b white',

test11: 'cfonts "a b c defghijklmnopqrstuvwxyz0123456789\!?.+-_=@#$%&()/:;ü" -f "simpleBlock"',
test12: 'cfonts "a b c defghijklmnopqrstuvwxyz0123456789\!?.+-_=@#$%&()/:;ü" -f "simpleBlock" -c green -b white',

test13: 'cfonts "a b c defghijklmnopqrstuvwxyz0123456789\!?.+-_=@#$%&()/:;ü" -a "center"',
test13: 'cfonts "a b c" -a right',
},
});


Expand Down
144 changes: 90 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
```shell
██████╗ ███████╗ ██████╗ ███╗ ██╗ ████████╗ ███████╗
██╔════╝ ██╔════╝ ██╔═══██╗ ████╗ ██║ ╚══██╔══╝ ██╔════╝
██║ █████╗ ██║ ██║ ██╔██╗ ██║ ██║ ███████╗
██║ ██╔══╝ ██║ ██║ ██║╚██╗██║ ██║ ╚════██║
╚██████╗ ██║ ╚██████╔╝ ██║ ╚████║ ██║ ███████║
╚═════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝ ╚══════╝
██████╗ ███████╗ ██████╗ ███╗ ██╗ ████████╗ ███████╗
██╔════╝ ██╔════╝ ██╔═══██╗ ████╗ ██║ ╚══██╔══╝ ██╔════╝
██║ █████╗ ██║ ██║ ██╔██╗ ██║ ██║ ███████╗
██║ ██╔══╝ ██║ ██║ ██║╚██╗██║ ██║ ╚════██║
╚██████╗ ██║ ╚██████╔╝ ██║ ╚████║ ██║ ███████║
╚═════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝ ╚══════╝
```

[![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.
> This is a silly little command line tool for sexy fonts in the console. **Give your cli some love.**
## Examples

Expand All @@ -28,34 +28,43 @@ Real world example:
To install the CLI app, simply NPM install it globally.

```shell
$ sudo npm install cfonts -g
$ npm install cfonts -g
```

To use it in your project:
To use it in your shell:

```shell
$ cfonts "Hello|World\!"
```

_Remember to escape the `!` character with `\` in the shell_

Or use it in your project:

```js
var FONTS = require('cfonts');

var fonts = new FONTS({
'text': 'Hello World', //text to be converted
'font': 'block', //define the font face
'colors': '', //define all colors
'background': 'Black', //define the background color
'letterSpacing': 1, //define letter spacing
'space': true, //define if the output text should have empty lines on top and on the bottom
'maxLength': '10' //define how many character can be on one line
var CFonts = require('cfonts');

CFonts.say('Hello|world!', {
'font': 'block', //define the font face
'align': 'left', //define text alignment
'colors': ['white'], //define all colors
'background': 'Black', //define the background color
'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
});
```

_Remember to escape the `!` character with `\` in the shell_
_All settings are optional and shown here with their default_


## Usage

Using the CLI is easy.

```
Usage: cfonts <command> <param1>,<param2> <command> <param1> etc...
Usage: cfonts "<value>" [option1] <input1> [option2] <input1>,<input2> [option3] etc...
```

At any point you can run the *help* command to get a full list of commands and
Expand Down Expand Up @@ -129,7 +138,7 @@ _The `|` character will be replaced with a line break_
## Options

#### -h, --help
Type: `<command>`
Type: `<command>`
Default value: `none`

This shows a list of all available options.
Expand All @@ -140,7 +149,7 @@ $ cfonts --help


#### -V, --version
Type: `<command>`
Type: `<command>`
Default value: `none`

This shows the installed version.
Expand All @@ -150,40 +159,56 @@ $ cfonts --version
```


#### -t, --text
Type: `<string>`
#### text
Type: `<string>`
Default value: `""`

This is the "textinput" to be converted into a nice font

```shell
$ cfonts --text "Hello world!"
$ cfonts "Hello world"
```


#### -f, --font
Type: `<string>`
Type: `<string>`
Default value: `"block"`

This is the font face you want to use. So far this plugin ships with with following font faces:

* `console` [colors: 1]
* `block` [colors: 2]
* `simple` [colors: 1]
* `3d` [colors: 2]
* `simple3d` [colors: 1]
- `console` [colors: 1]
- `block` [colors: 2] _(default)_
- `simpleBlock` [colors: 1]
- `simple` [colors: 1]
- `3d` [colors: 2]
- `simple3d` [colors: 1]

```shell
$ cfonts --font "block"
$ cfonts "text" -f "block3d"
```


#### -a, --align
Type: `<string>`
Default value: `"left"`

You can align your text in the terminal with this option. Use the keywords below:

- `left` _(default)_
- `center`
- `right`

```shell
$ cfonts "text" -a "center"
```


#### -c, --colors
Type: `<string list>`
Type: `<string list>`
Default value: `[]`

In this setting you can set the colors for each font face. Use the below color strings build in by [chalk](https://github.com/sindresorhus/chalk).
Provide colors in a comma-separated string, eg: `red,blue`
With this setting you can set the colors for your font. Use the below color strings built in by [chalk](https://github.com/sindresorhus/chalk).
Provide colors in a comma-separated string, eg: `red,blue` _(no spaces)_

- `black`
- `red`
Expand All @@ -192,22 +217,22 @@ Provide colors in a comma-separated string, eg: `red,blue`
- `blue`
- `magenta`
- `cyan`
- `white`
- `white` _(default)_
- `gray`

```shell
$ cfonts --colors white,blue
$ cfonts "text" --colors white,blue
```


#### -b, --background
Type: `<string>`
Type: `<string>`
Default value: `"Black"`

In this setting you can set the background colors for the output. Use the below color strings build in by [chalk](https://github.com/sindresorhus/chalk).
Provide the background color from the below supported list, eg: 'white'
With this setting you can set the background colors for the output. Use the below color strings built in by [chalk](https://github.com/sindresorhus/chalk).
Provide the background color from the below supported list, eg: 'White'

- `Black`
- `Black` _(default)_
- `Red`
- `Green`
- `Yellow`
Expand All @@ -217,41 +242,51 @@ Provide the background color from the below supported list, eg: 'white'
- `White`

```shell
$ cfonts --background "Green"
$ cfonts "text" --background "Green"
```


#### -l, --letter-spacing
Type: `<integer>`
Type: `<integer>`
Default value: `1`

Set this option to widen the space between characters.

```shell
$ cfonts --letter-spacing 2
$ cfonts "text" --letter-spacing 2
```


#### -z, --line-height
Type: `<integer>`
Default value: `1`

Set this option to widen the space between lines.

```shell
$ cfonts "text" --line-height 2
```


#### -s, --space
Type: `<boolen>`
#### -s, --spaceless
Type: `<boolen>`
Default value: `true`

Set this option to false if you don't want the plugin to insert two empty lines on top and on the bottom of the output.

```shell
$ cfonts --space false
$ cfonts "text" --spaceless
```


#### -m, --max-length
Type: `<integer>`
Default value: `10`
Type: `<integer>`
Default value: `0`

This option sets the maximum characters that will be printed on one line. As the shell usually doesn't give you access to its width, this is nessesary
to not end up with a scrambled text output.
This option sets the maximum characters that will be printed on one line. 0 means no max width and the text will break at the edge of the terminal window.

```shell
$ cfonts --max-length 15
$ cfonts "text" --max-length 15
```


Expand All @@ -260,6 +295,7 @@ Please look at the coding style and work with it, not against it ;)


## Release History
* 1.0.0 - refactor, added alignment and line height option, new cli commands, added simpleBlock
* 0.0.13 - fixed simple3d
* 0.0.12 - fixed simple3d and added to grunt test
* 0.0.11 - added simple3d font
Expand All @@ -276,4 +312,4 @@ Please look at the coding style and work with it, not against it ;)


## License
Copyright (c) 2015 Dominik Wilkowski. Licensed under the [GNU GPL](https://github.com/dominikwilkowski/cfonts/blob/master/LICENSE).
Copyright (c) 2016 Dominik Wilkowski. Licensed under the [GNU GPLv2](https://github.com/dominikwilkowski/cfonts/blob/master/LICENSE).
Loading

0 comments on commit ac210b3

Please sign in to comment.