MCPcopy Create free account
hub / github.com/Effect-TS/effect / getGlobalFlagsForCommandPath

Function getGlobalFlagsForCommandPath

packages/effect/src/cli/internal/help.ts:68–79  ·  view source on GitHub ↗
(
  command: Command<Name, Input, ContextInput, E, R>,
  commandPath: ReadonlyArray<string>,
  builtIns: ReadonlyArray<GlobalFlag.GlobalFlag<any>>
)

Source from the content-addressed store, hash-verified

66 * Built-ins are prepended and declarations are collected root -> leaf.
67 */
68export 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
81const collectDeclaredGlobalFlags = (command: Command.Any): ReadonlyArray<GlobalFlag.GlobalFlag<any>> => {
82 const collected: Array<GlobalFlag.GlobalFlag<any>> = []

Callers 2

runWithFunction · 0.90
getHelpForCommandPathFunction · 0.85

Calls 3

toImplFunction · 0.90
dedupeGlobalFlagsFunction · 0.85

Tested by

no test coverage detected