forked from NativeScript/nativescript-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheader.ts
37 lines (32 loc) · 1.13 KB
/
header.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { color, stripColors } from "../color";
import { IStaticConfig } from "../declarations";
import { injector } from "./yok";
export function printHeader() {
if (process.env.HIDE_HEADER) return;
const $staticConfig: IStaticConfig = injector.resolve("$staticConfig");
const version = $staticConfig.version;
const header = [
color.dim("│ "),
color.cyanBright.bold("{N} NativeScript "),
color.whiteBright.bold("CLI"),
color.dim(` [v${version}] `),
// color.dim(" │"),
].join("");
const tagLine = [
color.dim("│ "),
color.dim(" → "),
color.whiteBright.bold("Empower JavaScript with native APIs "),
// color.dim(" │"),
].join("");
const headerLength = stripColors(header).length;
const tagLineLength = stripColors(tagLine).length;
const width = Math.max(headerLength, tagLineLength);
console.info(" " + color.dim("┌" + "─".repeat(width - 1) + "┐"));
console.info(
" " + header + " ".repeat(width - headerLength) + color.dim("│")
);
console.info(
" " + tagLine + " ".repeat(width - tagLineLength) + color.dim("│")
);
console.info(" " + color.dim("└" + "─".repeat(width - 1) + "┘"));
}