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

Function appendChoiceKeys

packages/effect/src/unstable/cli/internal/command.ts:252–264  ·  view source on GitHub ↗
(
  description: Option.Option<string>,
  choiceKeys: ReadonlyArray<string> | undefined
)

Source from the content-addressed store, hash-verified

250}
251
252const appendChoiceKeys = (
253 description: Option.Option<string>,
254 choiceKeys: ReadonlyArray<string> | undefined
255): Option.Option<string> => {
256 if (choiceKeys === undefined || choiceKeys.length === 0) {
257 return description
258 }
259 const choiceSuffix = `(choices: ${choiceKeys.join(", ")})`
260 return Option.match(description, {
261 onNone: () => Option.some(choiceSuffix),
262 onSome: (value) => Option.some(`${value} ${choiceSuffix}`)
263 })
264}
265
266/**
267 * Creates a parser for a given config. Used as the default for both `parse`

Callers 1

toFlagDocFunction · 0.85

Calls 2

joinMethod · 0.80
someMethod · 0.80

Tested by

no test coverage detected