fix: local updates for PR #4780

Co-authored-by: jlowin <jlowin@users.noreply.github.com>
This commit is contained in:
Gustavo Madeira Santana
2026-01-30 15:39:05 -05:00
committed by Gustavo Madeira Santana
parent dd4715a2c4
commit f24e3cdae5
8 changed files with 250 additions and 57 deletions

View File

@@ -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;
}