mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-17 12:11:20 +00:00
refactor: dedupe cli lowercase helpers
This commit is contained in:
@@ -3,7 +3,10 @@ import type { CronJob } from "../../cron/types.js";
|
||||
import { danger } from "../../globals.js";
|
||||
import { sanitizeAgentId } from "../../routing/session-key.js";
|
||||
import { defaultRuntime } from "../../runtime.js";
|
||||
import { normalizeOptionalString } from "../../shared/string-coerce.js";
|
||||
import {
|
||||
normalizeOptionalLowercaseString,
|
||||
normalizeOptionalString,
|
||||
} from "../../shared/string-coerce.js";
|
||||
import { addGatewayClientOptions, callGatewayFromCli } from "../gateway-rpc.js";
|
||||
import {
|
||||
applyExistingCronSchedulePatch,
|
||||
@@ -279,8 +282,7 @@ export function registerCronEditCommand(cron: Command) {
|
||||
failureAlert.after = after;
|
||||
}
|
||||
if (hasFailureAlertChannel) {
|
||||
const channel = String(opts.failureAlertChannel).trim().toLowerCase();
|
||||
failureAlert.channel = channel ? channel : undefined;
|
||||
failureAlert.channel = normalizeOptionalLowercaseString(opts.failureAlertChannel);
|
||||
}
|
||||
if (hasFailureAlertTo) {
|
||||
const to = String(opts.failureAlertTo).trim();
|
||||
@@ -294,7 +296,7 @@ export function registerCronEditCommand(cron: Command) {
|
||||
failureAlert.cooldownMs = cooldownMs;
|
||||
}
|
||||
if (hasFailureAlertMode) {
|
||||
const mode = String(opts.failureAlertMode).trim().toLowerCase();
|
||||
const mode = normalizeOptionalLowercaseString(opts.failureAlertMode);
|
||||
if (mode !== "announce" && mode !== "webhook") {
|
||||
throw new Error("Invalid --failure-alert-mode (must be 'announce' or 'webhook').");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user