Skip to content

Commit 13315a0

Browse files
committed
feat: add blue color support to printer and update tests
1 parent b5cd4c1 commit 13315a0

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

index.d.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ interface Printer {
457457
yellow(str: string): this;
458458
green(str: string): this;
459459
red(str: string): this;
460+
blue(str: string): this;
460461

461462
warning(...str: string[]): this;
462463
success(...str: string[]): this;
@@ -466,7 +467,7 @@ interface Printer {
466467
export const printer: Printer
467468

468469
export namespace helper {
469-
module fs {
470+
namespace fs {
470471
/**
471472
* get extension of file without dot
472473
* @param filename
@@ -585,7 +586,7 @@ export namespace helper {
585586
function _read_json(filepath: string): Promise<string>;
586587
}
587588

588-
module cmd {
589+
namespace cmd {
589590
/**
590591
* sleep by milliseconds
591592
* @param ms
@@ -694,7 +695,7 @@ export namespace helper {
694695
function _parallel(functions: Function[], options?: { parallelCount?: number, waitAll?: boolean }): Promise<void>
695696
}
696697

697-
module is {
698+
namespace is {
698699
function undefined(a: any): boolean
699700
function array(a: any): boolean
700701
function string(a: any): boolean

src/printer.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,14 @@ function red(str) {
137137
return this;
138138
}
139139

140+
function blue(str) {
141+
print(str.blue);
142+
return this;
143+
}
144+
140145
module.exports = {
141146
colors,
147+
142148
fixed,
143149
print,
144150
themes,
@@ -153,7 +159,9 @@ module.exports = {
153159
warning,
154160
success,
155161
error,
162+
156163
yellow,
157164
green,
165+
blue,
158166
red
159167
};

tests/printer.tests.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ describe('print test case', function () {
1717
printer.yellow('yellow').green('yellow');
1818
printer.green('green').red('red');
1919
printer.red('red').yellow('yellow');
20+
printer.blue('blue').green('green');
2021
printer.fixed('fixed str', 20, 'center').println('eol');
2122
printer.fixed('fixed').println('eol');
2223
// exec here is ok

0 commit comments

Comments
 (0)