Added version flag handling, added changelog

This commit is contained in:
Tomasz Weissbek 2018-06-13 12:19:06 +02:00
parent 1073407760
commit 964957b1db
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 name: geval
version: 1.0.0.0 version: 1.0.0.1
synopsis: Machine learning evaluation tools synopsis: Machine learning evaluation tools
description: Please see README.md description: Please see README.md
homepage: http://github.com/name/project homepage: http://github.com/name/project
@ -29,6 +29,7 @@ library
, GEval.BIO , GEval.BIO
, Data.Conduit.AutoDecompress , Data.Conduit.AutoDecompress
, Data.Conduit.SmartSource , Data.Conduit.SmartSource
, Paths_geval
build-depends: base >= 4.7 && < 5 build-depends: base >= 4.7 && < 5
, cond , cond
, conduit >= 1.3.0 , conduit >= 1.3.0

View File

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

View File

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