packages feed

darcs-benchmark-0.1.6: Config.hs

{-# LANGUAGE DeriveDataTypeable #-}

module Config where

import System.Console.CmdArgs

data Config = Get { repos :: [String] }
            | Run { fast  :: Bool
                  , cold  :: Bool
                  , only  :: [String]
                  , dump  :: Bool
                  , extra :: [String] }
            | Dist { repo :: FilePath }
              deriving (Show, Data, Typeable)

defaultConfig :: [Mode Config]
defaultConfig =
 [ mode $ Get { repos = []   &= args & typ "REPONAME" }
 , mode $ Run { fast = False &= text "Exclude the most time-consuming benchmarks"
              , cold = False &= text "Try to flush VM caches between iterations"
              , dump = False &= text "Produce machine-readable output on stdout"
              , only =  []   &= text "Only run benchmarks with one of these substrings in their names" & typ "BENCHMARK"
              , extra = []   &= args & typ "BINARY"
              }
 , mode $ Dist { repo = "" &= argPos 0 & typ "DIRECTORY" }
 ]