Skip to content

Commit 7e4ba94

Browse files
committed
feat(CLI): add smaller ascii art for clients with 74-84 columns
1 parent a8e0162 commit 7e4ba94

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/cli/tests/cli.unit.spec.ts

+6
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ test('ascii art shows if stdout has 85+ columns', async t => {
107107
t.regex(jumbo, new RegExp(snippet));
108108
});
109109

110+
test('small ascii art shows if stdout has 74-84 columns', async t => {
111+
const jumbo = getIntro(80);
112+
const snippet = `| _| || | '_ \\/ -_|_-</ _| '_| | '_ \\ _|`;
113+
t.regex(jumbo, new RegExp(snippet));
114+
});
115+
110116
const mockErr = (code?: string | number) =>
111117
((() => {
112118
const err = new Error();

src/cli/utils.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,17 @@ export function getIntro(columns: number | undefined): string {
4848
|___/|_| |_|
4949
`;
5050

51+
const asciiSmaller = `
52+
_ _ _ _ _
53+
| |_ _ _ _ __ ___ ___ __ _ _(_)_ __| |_ ___ __| |_ __ _ _ _| |_ ___ _ _
54+
| _| || | '_ \\/ -_|_-</ _| '_| | '_ \\ _|___(_-< _/ _\` | '_| _/ -_) '_|
55+
\\__|\\_, | .__/\\___/__/\\__|_| |_| .__/\\__| /__/\\__\\__,_|_| \\__\\___|_|
56+
|__/|_| |_|
57+
`;
58+
5159
return columns && columns >= 85
5260
? chalk.bold(gradient.mind(ascii))
53-
: `\n${chalk.cyan.bold.underline('typescript-starter')}\n`;
61+
: columns && columns >= 74
62+
? chalk.bold(gradient.mind(asciiSmaller))
63+
: `\n${chalk.cyan.bold.underline('typescript-starter')}\n`;
5464
}

0 commit comments

Comments
 (0)