{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module Stack.Options.BenchParser
( benchOptsParser
) where
import Options.Applicative
( Parser, flag', help, long, metavar, strOption )
import Options.Applicative.Builder.Extra ( optionalFirst )
import Stack.Prelude
import Stack.Options.Utils ( hideMods )
import Stack.Types.BuildOpts ( BenchmarkOptsMonoid (..) )
benchOptsParser :: Bool -> Parser BenchmarkOptsMonoid
benchOptsParser :: Bool -> Parser BenchmarkOptsMonoid
benchOptsParser Bool
hide0 = First String -> First Bool -> BenchmarkOptsMonoid
BenchmarkOptsMonoid
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (f :: * -> *) a. Alternative f => f a -> f (First a)
optionalFirst (forall s. IsString s => Mod OptionFields s -> Parser s
strOption
( forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"benchmark-arguments"
forall a. Semigroup a => a -> a -> a
<> forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"ba"
forall a. Semigroup a => a -> a -> a
<> forall (f :: * -> *) a. HasMetavar f => String -> Mod f a
metavar String
"BENCH_ARGS"
forall a. Semigroup a => a -> a -> a
<> forall (f :: * -> *) a. String -> Mod f a
help String
"Forward BENCH_ARGS to the benchmark suite. Supports templates \
\from 'cabal bench'."
forall a. Semigroup a => a -> a -> a
<> forall {f :: * -> *} {a}. Mod f a
hide
))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (f :: * -> *) a. Alternative f => f a -> f (First a)
optionalFirst (forall a. a -> Mod FlagFields a -> Parser a
flag' Bool
True
( forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"no-run-benchmarks"
forall a. Semigroup a => a -> a -> a
<> forall (f :: * -> *) a. String -> Mod f a
help String
"Disable running of benchmarks. (Benchmarks will still be \
\built.)"
forall a. Semigroup a => a -> a -> a
<> forall {f :: * -> *} {a}. Mod f a
hide
))
where
hide :: Mod f a
hide = forall (f :: * -> *) a. Bool -> Mod f a
hideMods Bool
hide0