chshersh / iris

🌈 Haskell CLI Framework supporting Command Line Interface Guidelines
https://hackage.haskell.org/package/iris
Mozilla Public License 2.0
181 stars 22 forks source link

Implement switch parsers #20

Open chshersh opened 2 years ago

chshersh commented 2 years ago

optparse-applicative provides a switch parser with the following type:

switch :: Mod FlagFields Bool -> Parser Bool

It's not entirely clear what does the Bool mean: Is it True when the argument is enabled or when it's default?

I propose to introduce a helper parser in the Iris.Cli.OnOff module:

data OnOff
    = Off
    | On

onoff :: Mod FlagFields Bool -> Parser OnOff