mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-26 00:21:59 +00:00
refactor: dedupe cli lowercase helpers
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
type PairingChannel,
|
||||
} from "../pairing/pairing-store.js";
|
||||
import { defaultRuntime } from "../runtime.js";
|
||||
import { normalizeLowercaseStringOrEmpty } from "../shared/string-coerce.js";
|
||||
import { formatDocsLink } from "../terminal/links.js";
|
||||
import { getTerminalTableWidth, renderTable } from "../terminal/table.js";
|
||||
import { theme } from "../terminal/theme.js";
|
||||
@@ -16,15 +17,14 @@ import { formatCliCommand } from "./command-format.js";
|
||||
|
||||
/** Parse channel, allowing extension channels not in core registry. */
|
||||
function parseChannel(raw: unknown, channels: PairingChannel[]): PairingChannel {
|
||||
const value = (
|
||||
typeof raw === "string"
|
||||
const value = normalizeLowercaseStringOrEmpty(
|
||||
(typeof raw === "string"
|
||||
? raw
|
||||
: typeof raw === "number" || typeof raw === "boolean"
|
||||
? String(raw)
|
||||
: ""
|
||||
)
|
||||
.trim()
|
||||
.toLowerCase();
|
||||
).trim(),
|
||||
);
|
||||
if (!value) {
|
||||
throw new Error("Channel required");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user