diff --git a/src/Utils.hs b/src/Utils.hs index 5325d6e13ed2890fe0f4b791ee256bf80924701b..e092f72049be940142309d3867a11a16d62fc6f0 100644 --- a/src/Utils.hs +++ b/src/Utils.hs @@ -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 diff --git a/src/hbal.hs b/src/hbal.hs index 9f7c1ddc216d894c829df776648d58387ce749d7..fea3f9ff55f0cda270ff95841edf30bbb49e8877 100644 --- a/src/hbal.hs +++ b/src/hbal.hs @@ -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 diff --git a/src/hn1.hs b/src/hn1.hs index 9ab2d2bf71023de2be969f768ea2cd222df79393..2c8af7bbad92f032f59ab8b0920c7a8210907e00 100644 --- a/src/hn1.hs +++ b/src/hn1.hs @@ -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