mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-14 03:20:49 +00:00
refactor(cli): share runtime status color rendering
This commit is contained in:
@@ -14,7 +14,7 @@ import { resolveNodeService } from "../../daemon/node-service.js";
|
||||
import type { GatewayServiceRuntime } from "../../daemon/service-runtime.js";
|
||||
import { loadNodeHostConfig } from "../../node-host/config.js";
|
||||
import { defaultRuntime } from "../../runtime.js";
|
||||
import { colorize, theme } from "../../terminal/theme.js";
|
||||
import { colorize } from "../../terminal/theme.js";
|
||||
import { formatCliCommand } from "../command-format.js";
|
||||
import {
|
||||
runServiceRestart,
|
||||
@@ -27,7 +27,12 @@ import {
|
||||
createDaemonActionContext,
|
||||
installDaemonServiceAndEmit,
|
||||
} from "../daemon-cli/response.js";
|
||||
import { createCliStatusTextStyles, formatRuntimeStatus, parsePort } from "../daemon-cli/shared.js";
|
||||
import {
|
||||
createCliStatusTextStyles,
|
||||
formatRuntimeStatus,
|
||||
parsePort,
|
||||
resolveRuntimeStatusColor,
|
||||
} from "../daemon-cli/shared.js";
|
||||
|
||||
type NodeDaemonInstallOptions = {
|
||||
host?: string;
|
||||
@@ -261,15 +266,7 @@ export async function runNodeDaemonStatus(opts: NodeDaemonStatusOptions = {}) {
|
||||
|
||||
const runtimeLine = formatRuntimeStatus(runtime);
|
||||
if (runtimeLine) {
|
||||
const runtimeStatus = runtime?.status ?? "unknown";
|
||||
const runtimeColor =
|
||||
runtimeStatus === "running"
|
||||
? theme.success
|
||||
: runtimeStatus === "stopped"
|
||||
? theme.error
|
||||
: runtimeStatus === "unknown"
|
||||
? theme.muted
|
||||
: theme.warn;
|
||||
const runtimeColor = resolveRuntimeStatusColor(runtime?.status);
|
||||
defaultRuntime.log(`${label("Runtime:")} ${colorize(rich, runtimeColor, runtimeLine)}`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user