mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-13 11:00:50 +00:00
16 lines
570 B
TypeScript
16 lines
570 B
TypeScript
import type { Command } from "commander";
|
|
import type { ProgramContext } from "./context.js";
|
|
|
|
const PROGRAM_CONTEXT_SYMBOL: unique symbol = Symbol.for("openclaw.cli.programContext");
|
|
|
|
export function setProgramContext(program: Command, ctx: ProgramContext): void {
|
|
(program as Command & { [PROGRAM_CONTEXT_SYMBOL]?: ProgramContext })[PROGRAM_CONTEXT_SYMBOL] =
|
|
ctx;
|
|
}
|
|
|
|
export function getProgramContext(program: Command): ProgramContext | undefined {
|
|
return (program as Command & { [PROGRAM_CONTEXT_SYMBOL]?: ProgramContext })[
|
|
PROGRAM_CONTEXT_SYMBOL
|
|
];
|
|
}
|