apple / swift-argument-parser

Straightforward, type-safe argument parsing for Swift
Apache License 2.0
3.31k stars 311 forks source link

Allow custom names for inversions of bool flags #581

Closed ashgti closed 10 months ago

ashgti commented 1 year ago

It would be useful to have the ability to customize the inversion name of a boolean flag.

For example you might have --grow and --shrink.

Maybe the FlagInversion can take a .customLong name to allow for full control of the flag spelling.

natecook1000 commented 10 months ago

Hi @ashgti – this is handled by conforming to the EnumerableFlag protocol. See an example in the documentation here: https://swiftpackageindex.com/apple/swift-argument-parser/1.2.3/documentation/argumentparser/enumerableflag