( single: Param.Single<typeof Param.flagKind, unknown>, metadata: ReturnType<typeof Param.getParamMetadata> )
| 242 | * @internal |
| 243 | */ |
| 244 | export const toFlagDoc = ( |
| 245 | single: Param.Single<typeof Param.flagKind, unknown>, |
| 246 | metadata: ReturnType<typeof Param.getParamMetadata> |
| 247 | ): FlagDoc => { |
| 248 | const formattedAliases = single.aliases.map((alias) => alias.length === 1 ? `-${alias}` : `--${alias}`) |
| 249 | const type = single.typeName ?? Primitive.getTypeName(single.primitiveType) |
| 250 | return { |
| 251 | name: single.name, |
| 252 | aliases: formattedAliases, |
| 253 | type: single.optionalValue === undefined ? type : `[=${type}]`, |
| 254 | description: appendChoiceKeys(single.description, Primitive.getChoiceKeys(single.primitiveType)), |
| 255 | required: single.primitiveType._tag !== "Boolean" && !metadata.isOptional |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | const appendChoiceKeys = ( |
| 260 | description: Option.Option<string>, |
no test coverage detected