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