Matthias Andreas Benkard | 262110d | 2021-08-24 06:35:55 +0200 | [diff] [blame^] | 1 | {-# LANGUAGE TypeApplications #-} |
| 2 | {-# LANGUAGE UndecidableInstances #-} |
| 3 | |
| 4 | module Mulkup.Flags (Flags (..), flagParser) where |
| 5 | |
| 6 | import Mulkup.Prelude |
| 7 | import Optics.TH |
| 8 | import Options.Applicative |
| 9 | ( Parser, |
| 10 | help, |
| 11 | long, |
| 12 | short, |
| 13 | switch, |
| 14 | ) |
| 15 | |
| 16 | data Flags = Flags |
| 17 | {verbose :: Bool} |
| 18 | |
| 19 | makeFieldLabelsNoPrefix ''Flags |
| 20 | |
| 21 | flagParser :: Parser Flags |
| 22 | flagParser = |
| 23 | Flags <$> switch (long "verbose" <> short 'v' <> help "Log verbosely.") |