Skip to content

Commit 7fc5010

Browse files
add small title for shorter window
1 parent 4ea0844 commit 7fc5010

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

.changeset/four-tomatoes-rescue.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"create-better-t-stack": patch
3+
---
4+
5+
add small title for shorter window

apps/cli/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ async function gatherConfig(
189189
async function main() {
190190
const s = spinner();
191191
try {
192-
console.clear();
192+
process.stdout.write("\x1Bc");
193193
renderTitle();
194194
intro(chalk.bold("Creating a new Better-T Stack project"));
195195
program

apps/cli/src/render-title.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,20 @@ const catppuccinTheme = {
1818
};
1919

2020
export const renderTitle = () => {
21-
const catppuccinGradient = gradient(Object.values(catppuccinTheme));
22-
console.log(catppuccinGradient.multiline(TITLE_TEXT));
21+
const terminalWidth = process.stdout.columns || 80;
22+
const titleLines = TITLE_TEXT.split("\n");
23+
const titleWidth = Math.max(...titleLines.map((line) => line.length));
24+
25+
if (terminalWidth < titleWidth) {
26+
const simplifiedTitle = `
27+
╔══════════════════╗
28+
║ Better T-Stack ║
29+
╚══════════════════╝
30+
`;
31+
console.log(
32+
gradient(Object.values(catppuccinTheme)).multiline(simplifiedTitle),
33+
);
34+
} else {
35+
console.log(gradient(Object.values(catppuccinTheme)).multiline(TITLE_TEXT));
36+
}
2337
};

0 commit comments

Comments
 (0)