Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Options/Applicative/Builder.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module Options.Applicative.Builder (
subparser,
strArgument,
argument,
optionalArg,
flag,
flag',
switch,
Expand Down Expand Up @@ -297,6 +298,10 @@ argument p m = mkParser d g (ArgReader rdr)
strArgument :: IsString s => Mod ArgumentFields s -> Parser s
strArgument = argument str

-- | Builder for an optional argument.
optionalArg :: ReadM a -> Mod ArgumentFields (Maybe a) -> Parser (Maybe a)
optionalArg p m = argument (Just <$> p) (m <> value Nothing)

-- | Builder for a flag parser.
--
-- A flag that switches from a \"default value\" to an \"active value\" when
Expand Down