mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 11:21:23 +00:00
fix: local updates for PR #4780
Co-authored-by: jlowin <jlowin@users.noreply.github.com>
This commit is contained in:
committed by
Gustavo Madeira Santana
parent
dd4715a2c4
commit
f24e3cdae5
@@ -1,3 +1,5 @@
|
||||
import type { Command } from "commander";
|
||||
|
||||
export type ManagerLookupResult<T> = {
|
||||
manager: T | null;
|
||||
error?: string;
|
||||
@@ -46,3 +48,16 @@ export async function runCommandWithRuntime(
|
||||
runtime.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
export function resolveOptionFromCommand<T>(
|
||||
command: Command | undefined,
|
||||
key: string,
|
||||
): T | undefined {
|
||||
let current: Command | null | undefined = command;
|
||||
while (current) {
|
||||
const opts = (current.opts?.() ?? {}) as Record<string, T | undefined>;
|
||||
if (opts[key] !== undefined) return opts[key];
|
||||
current = current.parent ?? undefined;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user