mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-13 11:00:50 +00:00
refactor(daemon-cli): share status text styling
This commit is contained in:
@@ -14,7 +14,7 @@ import { resolveGatewayLogPaths } from "../../daemon/launchd.js";
|
||||
import { resolveNodeService } from "../../daemon/node-service.js";
|
||||
import { loadNodeHostConfig } from "../../node-host/config.js";
|
||||
import { defaultRuntime } from "../../runtime.js";
|
||||
import { colorize, isRich, theme } from "../../terminal/theme.js";
|
||||
import { colorize, theme } from "../../terminal/theme.js";
|
||||
import { formatCliCommand } from "../command-format.js";
|
||||
import {
|
||||
runServiceRestart,
|
||||
@@ -27,7 +27,7 @@ import {
|
||||
createDaemonActionContext,
|
||||
installDaemonServiceAndEmit,
|
||||
} from "../daemon-cli/response.js";
|
||||
import { formatRuntimeStatus, parsePort } from "../daemon-cli/shared.js";
|
||||
import { createCliStatusTextStyles, formatRuntimeStatus, parsePort } from "../daemon-cli/shared.js";
|
||||
|
||||
type NodeDaemonInstallOptions = {
|
||||
host?: string;
|
||||
@@ -243,13 +243,8 @@ export async function runNodeDaemonStatus(opts: NodeDaemonStatusOptions = {}) {
|
||||
return;
|
||||
}
|
||||
|
||||
const rich = isRich();
|
||||
const label = (value: string) => colorize(rich, theme.muted, value);
|
||||
const accent = (value: string) => colorize(rich, theme.accent, value);
|
||||
const infoText = (value: string) => colorize(rich, theme.info, value);
|
||||
const okText = (value: string) => colorize(rich, theme.success, value);
|
||||
const warnText = (value: string) => colorize(rich, theme.warn, value);
|
||||
const errorText = (value: string) => colorize(rich, theme.error, value);
|
||||
const { rich, label, accent, infoText, okText, warnText, errorText } =
|
||||
createCliStatusTextStyles();
|
||||
|
||||
const serviceStatus = loaded ? okText(service.loadedText) : warnText(service.notLoadedText);
|
||||
defaultRuntime.log(`${label("Service:")} ${accent(service.label)} (${serviceStatus})`);
|
||||
|
||||
Reference in New Issue
Block a user