UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

45 lines (44 loc) • 1.08 kB
import "./errors-BKzCeTYb.mjs"; import { r as isJsonOutputModeActive } from "./json-output-mode-DSme4Xvd.mjs"; import { i as formatCliOperatorError, o as isExpectedCliError } from "./failure-output-DVVDqwuu.mjs"; //#region src/cli/cli-utils.ts async function withManager(e) { const { manager: t, error: n } = await e.getManager(); if (!t) { e.onMissing(n); return; } try { await e.run(t); } finally { try { await e.close(t); } catch (t) { e.onCloseError?.(t); } } } async function runCommandWithRuntime(e, t, n) { try { await t(); } catch (t) { const { ExitError: r } = await import("./runtime-PcIG_sHE.mjs"); if (t instanceof r || isJsonOutputModeActive(process.argv) || isExpectedCliError(t)) throw t; if (n) { n(t); return; } e.error(formatCliOperatorError(t)); e.exit(1); } } function resolveOptionFromCommand(e, t) { let n = e; while (n) { const e = n.opts?.() ?? {}; if (e[t] !== void 0) return e[t]; n = n.parent; } } //#endregion export { runCommandWithRuntime as n, withManager as r, resolveOptionFromCommand as t };