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

Function showHelp

packages/effect/src/unstable/cli/Command.ts:1667–1680  ·  view source on GitHub ↗
(
  command: Command<Name, Input, ContextInput, E, R>,
  error: CliError.ShowHelp,
  renderErrors: boolean
)

Source from the content-addressed store, hash-verified

1665}
1666
1667const showHelp = <Name extends string, Input, E, R, ContextInput>(
1668 command: Command<Name, Input, ContextInput, E, R>,
1669 error: CliError.ShowHelp,
1670 renderErrors: boolean
1671): Effect.Effect<void, CliError.CliError, Environment> =>
1672 Effect.gen(function*() {
1673 const { builtIns } = yield* CliConfig.CliConfig
1674 const formatter = yield* CliOutput.Formatter
1675 const helpDoc = yield* getHelpForCommandPath(command, error.commandPath, builtIns)
1676 yield* Console.log(formatter.formatHelpDoc(helpDoc))
1677 if (renderErrors && error.errors.length > 0) {
1678 yield* Console.error(formatter.formatErrors(error.errors as any))
1679 }
1680 })
1681
1682const showUserError = (error: CliError.UserError): Effect.Effect<void> =>
1683 Effect.gen(function*() {

Callers 1

runWithFunction · 0.85

Calls 3

getHelpForCommandPathFunction · 0.90
errorMethod · 0.80
logMethod · 0.65

Tested by

no test coverage detected