Merge branch 'handle-version-option' into 'master'

Added version flag handling, added changelog

Closes #7

See merge request filipg/geval!1
This commit is contained in:
Filip Graliński 2018-06-13 10:46:34 +00:00
commit e0e06196f0
4 changed files with 17 additions and 2 deletions

3
CHANGELOG.md Normal file
View File

@ -0,0 +1,3 @@
## 1.0.0.1
* Added `--version`, `-v` options handling

View File

@ -1,5 +1,5 @@
name: geval
version: 1.0.0.0
version: 1.0.0.1
synopsis: Machine learning evaluation tools
description: Please see README.md
homepage: http://github.com/name/project
@ -29,6 +29,7 @@ library
, GEval.BIO
, Data.Conduit.AutoDecompress
, Data.Conduit.SmartSource
, Paths_geval
build-depends: base >= 4.7 && < 5
, cond
, conduit >= 1.3.0

View File

@ -203,7 +203,7 @@ getExpectedDirectory :: GEvalSpecification -> FilePath
getExpectedDirectory spec = fromMaybe outDirectory $ gesExpectedDirectory spec
where outDirectory = gesOutDirectory spec
data GEvalSpecialCommand = Init | LineByLine | Diff FilePath
data GEvalSpecialCommand = Init | LineByLine | Diff FilePath | PrintVersion
data ResultOrdering = KeepTheOriginalOrder | FirstTheWorst | FirstTheBest

View File

@ -6,6 +6,9 @@ module GEval.OptionsParser
runGEvalGetOptions,
getOptions) where
import Paths_geval (version)
import Data.Version (showVersion)
import Options.Applicative
import qualified System.Directory as D
import System.FilePath
@ -31,6 +34,11 @@ optionsParser = GEvalOptions
( long "init"
<> help "Init a sample Gonito challenge rather than run an evaluation" ))
<|>
(flag' PrintVersion
( long "version"
<> short 'v'
<> help "Print GEval version" ))
<|>
(flag' LineByLine
( long "line-by-line"
<> short 'l'
@ -178,6 +186,9 @@ runGEval''' Nothing _ spec = do
runGEval''' (Just Init) _ spec = do
initChallenge spec
return Nothing
runGEval''' (Just PrintVersion) _ _ = do
putStrLn ("geval " ++ showVersion version)
return Nothing
runGEval''' (Just LineByLine) ordering spec = do
runLineByLine ordering spec
return Nothing