| 250 | } |
| 251 | |
| 252 | const 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` |