diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c41795d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +## 1.0.0.1 + +* Added `--version`, `-v` options handling \ No newline at end of file diff --git a/geval.cabal b/geval.cabal index b248a9b..3efbcc6 100644 --- a/geval.cabal +++ b/geval.cabal @@ -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 diff --git a/src/GEval/Core.hs b/src/GEval/Core.hs index 3152ae5..9272438 100644 --- a/src/GEval/Core.hs +++ b/src/GEval/Core.hs @@ -197,7 +197,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 diff --git a/src/GEval/OptionsParser.hs b/src/GEval/OptionsParser.hs index 900a101..a5774a7 100644 --- a/src/GEval/OptionsParser.hs +++ b/src/GEval/OptionsParser.hs @@ -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