MCPcopy
hub / github.com/Effect-TS/effect / getWizardPrefix

Function getWizardPrefix

packages/cli/src/internal/cliApp.ts:331–346  ·  view source on GitHub ↗
(
  builtIn: BuiltInOptions.ShowWizard,
  rootCommand: string,
  commandLineArgs: ReadonlyArray<string>
)

Source from the content-addressed store, hash-verified

329}
330
331const getWizardPrefix = (
332 builtIn: BuiltInOptions.ShowWizard,
333 rootCommand: string,
334 commandLineArgs: ReadonlyArray<string>
335): ReadonlyArray<string> => {
336 const subcommands = InternalCommand.getSubcommands(builtIn.command)
337 const [parentArgs, childArgs] = Arr.span(
338 commandLineArgs,
339 (name) => !HashMap.has(subcommands, name)
340 )
341 const args = Arr.matchLeft(childArgs, {
342 onEmpty: () => Arr.filter(parentArgs, (arg) => arg !== "--wizard"),
343 onNonEmpty: (head) => Arr.append(parentArgs, head)
344 })
345 return Arr.appendAll(rootCommand.split(/\s+/), args)
346}
347
348const renderWizardArgs = (args: ReadonlyArray<string>) => {
349 const params = pipe(

Callers 1

handleBuiltInOptionFunction · 0.85

Calls 2

spanMethod · 0.80
splitMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…