Adds version option to the executable.

pull/1/head
Abhinav Sarkar 2016-03-25 01:59:01 +05:30
parent c819578006
commit 15c549a6e8
1 changed files with 9 additions and 1 deletions

View File

@ -5,8 +5,11 @@ module Ringo.ArgParser (ProgArgs(..), parseArgs) where
import qualified Data.Text as Text
import Data.List (intercalate)
import Data.Version (showVersion)
import Options.Applicative
import Paths_ringo (version)
import Ringo.Types
data ProgArgs = ProgArgs
@ -95,9 +98,14 @@ progArgsParser =
<> action "directory"
<> help "Output directory")
versionParser :: Parser (a -> a)
versionParser = infoOption ("ringo " ++ showVersion version)
(long "version"
<> help "Print version information")
parseArgs :: IO ProgArgs
parseArgs = execParser $
info (helper <*> progArgsParser)
info (helper <*> versionParser <*> progArgsParser)
(fullDesc
<> progDesc "Transforms OLTP database schemas to OLAP database star schemas"
<> header "ringo - OLTP to OLAP schema transformer"