mirror of
https://github.com/Gabriella439/Haskell-Optparse-Generic-Library.git
synced 2024-11-22 12:13:29 +03:00
Add getWithHelpWith (#94)
This commit is contained in:
parent
556ce41b8b
commit
5a5a1f9d6c
@ -1,3 +1,7 @@
|
||||
1.4.8
|
||||
|
||||
* [Add `getWithHelpWith`](https://github.com/Gabriel439/Haskell-Optparse-Generic-Library/pull/94)
|
||||
|
||||
1.4.7
|
||||
|
||||
* [Derive `Data` instances for exported types](https://github.com/Gabriel439/Haskell-Optparse-Generic-Library/pull/89)
|
||||
|
@ -288,6 +288,7 @@ module Options.Generic (
|
||||
-- * Parsers
|
||||
getRecord
|
||||
, getRecordWith
|
||||
, getWithHelpWith
|
||||
, getWithHelp
|
||||
, getRecordPure
|
||||
, getRecordPureWith
|
||||
@ -1133,8 +1134,20 @@ getWithHelp
|
||||
-- ^ Program description
|
||||
-> io (a, io ())
|
||||
-- ^ (options, io action to print help message)
|
||||
getWithHelp desc = do
|
||||
a <- getRecordWith header mempty
|
||||
getWithHelp desc = getWithHelpWith desc mempty
|
||||
|
||||
-- | Marshal any value that implements `ParseRecord` from the commmand line
|
||||
-- alongside an io action that prints the help message.
|
||||
getWithHelpWith
|
||||
:: (MonadIO io, ParseRecord a)
|
||||
=> Text
|
||||
-- ^ Program description
|
||||
-> Options.PrefsMod
|
||||
-- ^ 'ParserPrefs' modifiers
|
||||
-> io (a, io ())
|
||||
-- ^ (options, io action to print help message)
|
||||
getWithHelpWith desc prefsMods = do
|
||||
a <- getRecordWith header prefsMods
|
||||
return (a, help)
|
||||
where
|
||||
header = Options.header (Data.Text.unpack desc)
|
||||
|
Loading…
Reference in New Issue
Block a user