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

Function getCommandAtPath

packages/effect/src/unstable/cli/internal/wizard.ts:33–48  ·  view source on GitHub ↗
(
  command: Command.Command.Any,
  commandPath: ReadonlyArray<string>
)

Source from the content-addressed store, hash-verified

31)
32
33const getCommandAtPath = (
34 command: Command.Command.Any,
35 commandPath: ReadonlyArray<string>
36): Command.Command.Any => {
37 let current = command
38 for (const name of commandPath.slice(1)) {
39 const child = current.subcommands
40 .flatMap((group) => group.commands)
41 .find((candidate) => candidate.name === name || candidate.alias === name)
42 if (child === undefined) {
43 break
44 }
45 current = child
46 }
47 return current
48}
49
50const promptCommand: (
51 command: Command.Command.Any,

Callers 1

wizard.tsFile · 0.85

Calls 1

findMethod · 0.45

Tested by

no test coverage detected