Commit 29ac5975 authored by Iustin Pop's avatar Iustin Pop
Browse files

Abstract the version format into a function

This patch moves the version string creation into a function in Utils
which shows some more information.
parent b0045e4d
......@@ -2,11 +2,15 @@
module Utils where
import Data.List
import Data.Either
import Data.List
import qualified Data.Version
import Monad
import System
import System.IO
import Monad
import System.Info
import Text.Printf
import qualified Version
import Debug.Trace
......@@ -78,3 +82,11 @@ readData fn host = do
putStrLn $ fromLeft nd
exitWith $ ExitFailure 1
return $ fromRight nd
showVersion :: String -- ^ The program name
-> String -- ^ The formatted version and other information data
showVersion name =
printf "%s %s\ncompiled with %s %s\nrunning on %s %s\n"
name Version.version
compilerName (Data.Version.showVersion compilerVersion)
os arch
......@@ -140,7 +140,7 @@ main = do
(opts, _) <- parseOpts cmd_args
when (optShowVer opts) $ do
printf "hbal %s\n" Version.version
putStr $ showVersion "hbal"
exitWith ExitSuccess
let oneline = optOneline opts
......
......@@ -132,7 +132,7 @@ main = do
(opts, _) <- parseOpts cmd_args
when (optShowVer opts) $ do
printf "hn1 %s\n" Version.version
printf $ showVersion "hn1"
exitWith ExitSuccess
let min_depth = optMinDepth opts
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment