Refactor helper function (for Gonito)
This commit is contained in:
parent
5bd2eee13e
commit
4e033b8adb
@ -1,5 +1,5 @@
|
||||
name: geval
|
||||
version: 1.37.0.0
|
||||
version: 1.37.1.0
|
||||
synopsis: Machine learning evaluation tools
|
||||
description: Please see README.md
|
||||
homepage: http://github.com/name/project
|
||||
|
@ -347,18 +347,21 @@ getOptions' readOptsFromConfigFile args =
|
||||
otherwise -> return $ Left parserResult
|
||||
where parserResult = execParserPure (prefs idm) fullOptionsParser args
|
||||
|
||||
readOptsFromConfigFile :: [String] -> FilePath -> IO (Either (ParserResult GEvalOptions) GEvalOptions)
|
||||
readOptsFromConfigFile args configFilePath = do
|
||||
configH <- openFile configFilePath ReadMode
|
||||
contents <- hGetContents configH
|
||||
getOptions' False ((words contents) ++ args)
|
||||
|
||||
attemptToReadOptsFromConfigFile :: [String] -> GEvalOptions -> IO (Either (ParserResult GEvalOptions) GEvalOptions)
|
||||
attemptToReadOptsFromConfigFile args opts = do
|
||||
configExists <- D.doesFileExist configFilePath
|
||||
if configExists then do
|
||||
configH <- openFile configFilePath ReadMode
|
||||
contents <- hGetContents configH
|
||||
getOptions' False ((words contents) ++ args)
|
||||
readOptsFromConfigFile args configFilePath
|
||||
else
|
||||
getOptions' False args
|
||||
where configFilePath = (getExpectedDirectory $ geoSpec opts) </> configFileName
|
||||
|
||||
|
||||
runGEval'' :: GEvalOptions -> IO (Maybe [(SourceSpec, [MetricResult])])
|
||||
runGEval'' opts = runGEval''' (geoSpecialCommand opts)
|
||||
(geoResultOrdering opts)
|
||||
|
Loading…
Reference in New Issue
Block a user