refactor: polish CLI theme + progress helpers

This commit is contained in:
Peter Steinberger
2026-01-08 05:58:43 +01:00
parent e758cccd46
commit b8a186fbd3
6 changed files with 59 additions and 25 deletions

View File

@@ -1,5 +1,4 @@
import { existsSync } from "node:fs";
import chalk from "chalk";
import { promptYesNo } from "../cli/prompt.js";
import {
danger,
@@ -8,6 +7,7 @@ import {
shouldLogVerbose,
warn,
} from "../globals.js";
import { colorize, isRich, theme } from "../terminal/theme.js";
import { runExec } from "../process/exec.js";
import { defaultRuntime, type RuntimeEnv } from "../runtime.js";
import { ensureBinary } from "./binaries.js";
@@ -180,8 +180,17 @@ export async function ensureFunnel(
),
);
if (shouldLogVerbose()) {
if (stdout.trim()) runtime.error(chalk.gray(`stdout: ${stdout.trim()}`));
if (stderr.trim()) runtime.error(chalk.gray(`stderr: ${stderr.trim()}`));
const rich = isRich();
if (stdout.trim()) {
runtime.error(
colorize(rich, theme.muted, `stdout: ${stdout.trim()}`),
);
}
if (stderr.trim()) {
runtime.error(
colorize(rich, theme.muted, `stderr: ${stderr.trim()}`),
);
}
runtime.error(err as Error);
}
runtime.exit(1);