Remove Builder.Arguments module.

This commit is contained in:
Paolo Capriotti 2013-10-17 18:02:04 +01:00
parent cbee54f058
commit c5f1863ebf
3 changed files with 17 additions and 37 deletions

View File

@ -88,7 +88,7 @@ module Options.Applicative.Builder (
CommandFields
) where
import Control.Applicative (pure, (<|>))
import Control.Applicative (pure, (<|>), many, some)
import Data.Monoid (Monoid (..)
#if __GLASGOW_HASKELL__ > 702
, (<>)
@ -96,7 +96,6 @@ import Data.Monoid (Monoid (..)
)
import Options.Applicative.Builder.Completer
import Options.Applicative.Builder.Arguments
import Options.Applicative.Builder.Internal
import Options.Applicative.Common
import Options.Applicative.Types
@ -197,6 +196,22 @@ subparser m = mkParser d g rdr
Mod _ d g = m `mappend` metavar "COMMAND"
rdr = uncurry CmdReader (mkCommand m)
-- | Builder for an argument parser.
argument :: (String -> Maybe a) -> Mod ArgumentFields a -> Parser a
argument p (Mod f d g) = mkParser d g (ArgReader rdr)
where
ArgumentFields compl = f (ArgumentFields mempty)
rdr = CReader compl p
-- | Builder for an argument list parser. All arguments are collected and
-- returned as a list.
arguments :: (String -> Maybe a) -> Mod ArgumentFields a -> Parser [a]
arguments r m = many (argument r m)
-- | Like `arguments`, but require at least one argument.
arguments1 :: (String -> Maybe a) -> Mod ArgumentFields a -> Parser [a]
arguments1 r m = some (argument r m)
-- | Builder for a flag parser.
--
-- A flag that switches from a \"default value\" to an \"active value\" when

View File

@ -1,34 +0,0 @@
module Options.Applicative.Builder.Arguments
( argument
, arguments
, arguments1
) where
import Control.Applicative (many, some)
import Data.Monoid (mempty)
import Options.Applicative.Builder.Internal
import Options.Applicative.Common
import Options.Applicative.Types
-- | Builder for an argument parser.
argument :: (String -> Maybe a) -> Mod ArgumentFields a -> Parser a
argument p (Mod f d g) = mkParser d g (ArgReader rdr)
where
ArgumentFields compl = f (ArgumentFields mempty)
rdr = CReader compl p
-- | Builder for an argument list parser. All arguments are collected and
-- returned as a list.
--
-- Note that arguments starting with @'-'@ are ignored.
--
-- This parser accepts a special argument: @--@. When a @--@ is found on the
-- command line, all following arguments are included in the result, even if
-- they start with @'-'@.
arguments :: (String -> Maybe a) -> Mod ArgumentFields a -> Parser [a]
arguments r m = many (argument r m)
-- | Like `arguments`, but require at least one argument.
arguments1 :: (String -> Maybe a) -> Mod ArgumentFields a -> Parser [a]
arguments1 r m = some (argument r m)

View File

@ -91,7 +91,6 @@ library
Options.Applicative.Arrows,
Options.Applicative.BashCompletion,
Options.Applicative.Builder,
Options.Applicative.Builder.Arguments,
Options.Applicative.Builder.Completer,
Options.Applicative.Builder.Internal,
Options.Applicative.Common,