(client: Record<string, unknown>)
| 33 | * into them so the nested subcommands are not skipped. |
| 34 | */ |
| 35 | export function loadAllCommands(client: Record<string, unknown>): void { |
| 36 | const seen = new Set<unknown>(); |
| 37 | const loadAll = (obj: Record<string, unknown>) => { |
| 38 | if (seen.has(obj)) return; |
| 39 | seen.add(obj); |
| 40 | for (const [key, value] of Object.entries(obj)) { |
| 41 | if (key === "cli") { |
| 42 | continue; |
| 43 | } |
| 44 | if (isCommandModule(value)) { |
| 45 | value.load(); |
| 46 | } |
| 47 | if ( |
| 48 | (typeof value === "object" || typeof value === "function") && |
| 49 | value !== null && |
| 50 | !Array.isArray(value) |
| 51 | ) { |
| 52 | loadAll(value as Record<string, unknown>); |
| 53 | } |
| 54 | } |
| 55 | }; |
| 56 | loadAll(client); |
| 57 | } |
| 58 | |
| 59 | export function cli(pkg: any) { |
| 60 | const updateNotifier = updateNotifierPkg({ pkg }); |
no test coverage detected
searching dependent graphs…