@boy-offi9-inc/tidepull 0.7.2 → 0.7.3
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.
- package/dist/main.js +5 -3
- package/dist/ui/banner.d.ts +1 -1
- package/dist/ui/banner.js +27 -11
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -181,9 +181,7 @@ export async function main(argv) {
|
|
|
181
181
|
return 2;
|
|
182
182
|
}
|
|
183
183
|
const machineMode = values.quiet || values["dump-json"] || values["get-url"] || values.simulate || values["progress-json"];
|
|
184
|
-
|
|
185
|
-
process.stderr.write(renderBanner(VERSION, theme, !values["no-color"] && shouldUseColor()) + "\n");
|
|
186
|
-
}
|
|
184
|
+
const showBanner = process.stdout.isTTY && !machineMode;
|
|
187
185
|
const log = new Logger({
|
|
188
186
|
quiet: values.quiet,
|
|
189
187
|
verbose: values.verbose,
|
|
@@ -238,6 +236,10 @@ export async function main(argv) {
|
|
|
238
236
|
log.error(errMsg(e));
|
|
239
237
|
return e instanceof TidepullError ? e.exitCode : 1;
|
|
240
238
|
}
|
|
239
|
+
if (showBanner) {
|
|
240
|
+
const pluginNames = plugins.map((p) => p.name);
|
|
241
|
+
process.stderr.write(renderBanner(VERSION, theme, !values["no-color"] && shouldUseColor(), pluginNames) + "\n");
|
|
242
|
+
}
|
|
241
243
|
const tp = createTidepull({
|
|
242
244
|
http: { headers, headerHosts: values["header-host"] ?? [], userAgent: values["user-agent"], retries: num(values.retries, 3), cookies },
|
|
243
245
|
plugins: [...plugins, dash, feeds],
|
package/dist/ui/banner.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Theme } from "./theme.js";
|
|
2
|
-
export declare function renderBanner(version: string, theme: Theme, color?: boolean): string;
|
|
2
|
+
export declare function renderBanner(version: string, theme: Theme, color?: boolean, plugins?: string[]): string;
|
package/dist/ui/banner.js
CHANGED
|
@@ -28,22 +28,34 @@ function logo() {
|
|
|
28
28
|
}
|
|
29
29
|
return rows.map((r) => r.trimEnd());
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
const LOGO_COLS = 42;
|
|
32
|
+
function infoLines(version, theme, plain, plugins) {
|
|
32
33
|
const dim = (s) => (plain ? s : theme.dim + s + theme.reset);
|
|
33
34
|
const ok = (s) => (plain ? s : theme.success + s + theme.reset);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
`${dim("
|
|
38
|
-
|
|
35
|
+
const tag = (s) => (plain ? s : theme.tag + s + theme.reset);
|
|
36
|
+
const rows = [dim("media downloader"), `${dim("version")} ${ok(`v${version}`)}`, `${dim("stdout")} ${ok("data only")}`];
|
|
37
|
+
if (plugins.length)
|
|
38
|
+
rows.push(`${dim("plugins")} ${tag(plugins.join(", "))}`);
|
|
39
|
+
return rows;
|
|
39
40
|
}
|
|
40
|
-
export function renderBanner(version, theme, color = true) {
|
|
41
|
+
export function renderBanner(version, theme, color = true, plugins = []) {
|
|
41
42
|
const plain = !color || !!process.env.NO_COLOR || theme.name === "mono";
|
|
42
43
|
const paint = (c, s) => (plain ? s : c + s + theme.reset);
|
|
43
44
|
const rows = logo();
|
|
44
45
|
if (plain) {
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
const info = infoLines(version, theme, true, plugins);
|
|
47
|
+
const fold = info.length > 3 ? `${info[3]} v${version}` : undefined;
|
|
48
|
+
const shown = info.slice(0, 3);
|
|
49
|
+
if (fold)
|
|
50
|
+
shown[2] = shown[2];
|
|
51
|
+
const lines = [];
|
|
52
|
+
for (let r = 0; r < 3; r++) {
|
|
53
|
+
const pad = Math.max(2, LOGO_COLS - rows[r].length);
|
|
54
|
+
lines.push(rows[r] + " ".repeat(pad) + (shown[r] ?? ""));
|
|
55
|
+
}
|
|
56
|
+
if (fold)
|
|
57
|
+
lines.push(" ".repeat(LOGO_COLS + 2) + `${info[3]}`);
|
|
58
|
+
return lines.join("\n");
|
|
47
59
|
}
|
|
48
60
|
const stops = gradientStops(theme);
|
|
49
61
|
const starts = [0, 5, 9, 14, 19, 24, 29, 34];
|
|
@@ -57,12 +69,16 @@ export function renderBanner(version, theme, color = true) {
|
|
|
57
69
|
}
|
|
58
70
|
for (let r = 0; r < 3; r++)
|
|
59
71
|
painted[r] = painted[r].trimEnd() + theme.reset;
|
|
60
|
-
const info = infoLines(version, theme, plain);
|
|
72
|
+
const info = infoLines(version, theme, plain, plugins);
|
|
61
73
|
const visible = (s) => s.replace(/\x1b\[[0-9;]*m/g, "").length;
|
|
62
74
|
const lines = [];
|
|
63
75
|
for (let r = 0; r < 3; r++) {
|
|
64
|
-
const pad = Math.max(2,
|
|
76
|
+
const pad = Math.max(2, LOGO_COLS - visible(painted[r]));
|
|
65
77
|
lines.push(painted[r] + " ".repeat(pad) + (info[r] ?? ""));
|
|
66
78
|
}
|
|
79
|
+
if (info.length > 3)
|
|
80
|
+
lines.push(" ".repeat(LOGO_COLS + 2) + info[3]);
|
|
81
|
+
const waveStr = " ≈≈≈≈≈≈≈≈≈≈≈";
|
|
82
|
+
lines.push(paint(plain ? "" : theme.tag, waveStr));
|
|
67
83
|
return lines.join("\n");
|
|
68
84
|
}
|
package/package.json
CHANGED