Skip to content

Commit

Permalink
Add --version flag
Browse files Browse the repository at this point in the history
  • Loading branch information
jaspervdj committed May 21, 2017
1 parent f81bcc7 commit e500b07
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import qualified Data.ByteString.Lazy as BL
import qualified Data.Text as T
import qualified Data.Text.Encoding as T
import qualified Data.Text.Lazy.IO as TL
import Data.Version (showVersion)
import qualified Language.Javascript.JQuery as JQuery
import System.Environment (getArgs, getProgName)
import System.Exit (exitFailure)
Expand All @@ -20,7 +21,7 @@ import qualified System.IO as IO


--------------------------------------------------------------------------------
import Paths_profiteur (getDataFileName)
import Paths_profiteur (getDataFileName, version)
import Profiteur.Core
import Profiteur.Parser

Expand Down Expand Up @@ -87,6 +88,8 @@ main = do
progName <- getProgName
args <- getArgs
case args of
_ | "--version" `elem` args ->
putStrLn (showVersion version)
[profFile] -> do
profOrErr <- decode <$> TL.readFile profFile
case profOrErr of
Expand All @@ -95,6 +98,6 @@ main = do
Left err -> do
putStrLn $ profFile ++ ": " ++ err
exitFailure
_ -> do
_ -> do
putStrLn $ "Usage: " ++ progName ++ " <prof file>"
exitFailure

0 comments on commit e500b07

Please sign in to comment.