Skip to content

Add optparse-applicative support#78

Merged
chrisdone merged 1 commit intomainfrom
cd/2025-01-10-optparse
Jan 13, 2025
Merged

Add optparse-applicative support#78
chrisdone merged 1 commit intomainfrom
cd/2025-01-10-optparse

Conversation

@chrisdone
Copy link
Copy Markdown
Owner

-- Includes example of Semigroup.
data Opts = Opts {
  quiet :: Bool,
  filePath :: Text
 }
options =
  (\quiet path -> Main.Opts { quiet = quiet, filePath = path })
       <$> Options.switch (Flag.long "quiet" <> Flag.help "Be quiet?")
       <*> Options.strOption (Option.long "path" <> Option.help "The filepath to export")
main = do
  opts <- Options.execParser (Options.info (Main.options <**> Options.helper) Options.fullDesc)
  Text.putStrLn $ Record.get @"filePath" opts
  Text.putStrLn $ Show.show @Bool $ Record.get @"quiet" opts

@chrisdone chrisdone force-pushed the cd/2025-01-10-optparse branch from f535a6e to 5ae5938 Compare January 13, 2025 16:26
@chrisdone chrisdone merged commit a55d968 into main Jan 13, 2025
@chrisdone chrisdone deleted the cd/2025-01-10-optparse branch January 13, 2025 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant