( command: string | null, flags: Record<string, unknown>, )
| 47 | } |
| 48 | |
| 49 | export function applyCommandDefaults( |
| 50 | command: string | null, |
| 51 | flags: Record<string, unknown>, |
| 52 | ): boolean { |
| 53 | const commandSchema = getCommandSchema(command); |
| 54 | if (!commandSchema?.defaults) return false; |
| 55 | let changed = false; |
| 56 | for (const [key, value] of Object.entries(commandSchema.defaults) as Array<[FlagKey, unknown]>) { |
| 57 | if (flags[key] === undefined) { |
| 58 | flags[key] = value; |
| 59 | changed = true; |
| 60 | } |
| 61 | } |
| 62 | return changed; |
| 63 | } |
no test coverage detected