geval/app/Main.hs

65 lines
1.9 KiB
Haskell
Raw Normal View History

2015-08-17 23:32:00 +02:00
module Main where
2015-08-20 21:44:09 +02:00
import GEval
2015-08-17 23:32:00 +02:00
import System.Environment
2015-08-22 00:00:46 +02:00
import Options.Applicative
fullOptionsParser = info (helper <*> optionsParser)
(fullDesc
<> progDesc "Run evaluation for tests in Gonito platform"
<> header "geval - stand-alone evaluation tool for tests in Gonito platform")
optionsParser :: Parser GEvalOptions
optionsParser = GEvalOptions
<$> switch
( long "init"
<> help "Init a sample Gonito challange rather than run an evaluation" )
<*> specParser
specParser :: Parser GEvalSpecification
specParser = GEvalSpecification
<$> strOption
( long "out-directory"
<> value defaultOutDirectory
<> showDefault
<> metavar "OUT-DIRECTORY"
<> help "Directory with test results to be evaluated" )
<*> optional (strOption
( long "expected-directory"
<> metavar "EXPECTED-DIRECTORY"
<> help "Directory with expected test results (if not specified the same as OUT-DIRECTORY)" ))
<*> strOption
( long "test-name"
<> value defaultTestName
<> showDefault
<> metavar "NAME"
<> help "Test name (i.e. subdirectory with results or expected results)" )
<*> strOption
( long "out-file"
<> value defaultOutFile
<> showDefault
<> metavar "OUT"
<> help "The name of the file to be evaluated" )
<*> strOption
( long "expected-file"
<> value defaultExpectedFile
<> showDefault
<> metavar "EXPECTED"
<> help "The name of the file with expected results" )
<*> metricReader
metricReader :: Parser Metric
metricReader = option auto
( long "metric"
<> value defaultMetric
<> showDefault
<> metavar "METRIC"
<> help "Metric to be used" )
2015-08-17 23:32:00 +02:00
main :: IO ()
main = do
2015-08-22 00:00:46 +02:00
opts <- execParser fullOptionsParser
result <- geval $ geoSpec opts
2015-08-17 23:32:00 +02:00
print $ result