( command: Command<Name, Input, ContextInput, E, R>, commandPath: ReadonlyArray<string>, builtIns: ReadonlyArray<GlobalFlag.GlobalFlag<any>> )
| 66 | * Built-ins are prepended and declarations are collected root -> leaf. |
| 67 | */ |
| 68 | export const getGlobalFlagsForCommandPath = <Name extends string, Input, E, R, ContextInput>( |
| 69 | command: Command<Name, Input, ContextInput, E, R>, |
| 70 | commandPath: ReadonlyArray<string>, |
| 71 | builtIns: ReadonlyArray<GlobalFlag.GlobalFlag<any>> |
| 72 | ): ReadonlyArray<GlobalFlag.GlobalFlag<any>> => { |
| 73 | const commands = getCommandsForCommandPath(command, commandPath) |
| 74 | const declared = commands.flatMap((current) => toImpl(current).globalFlags) |
| 75 | return dedupeGlobalFlags([ |
| 76 | ...builtIns, |
| 77 | ...declared |
| 78 | ]) |
| 79 | } |
| 80 | |
| 81 | const collectDeclaredGlobalFlags = (command: Command.Any): ReadonlyArray<GlobalFlag.GlobalFlag<any>> => { |
| 82 | const collected: Array<GlobalFlag.GlobalFlag<any>> = [] |
no test coverage detected