[project @ 2000-06-20 11:03:55 by simonmar]
authorsimonmar <unknown>
Tue, 20 Jun 2000 11:03:55 +0000 (11:03 +0000)
committersimonmar <unknown>
Tue, 20 Jun 2000 11:03:55 +0000 (11:03 +0000)
- print the version number as x.yy.z (i.e. replace ", patchlevel z"
with ".z"), but omit the .z if z == 0.

- add --numeric-version flag which prints x.yy.z without the verbage.

ghc/driver/Main.hs

index f71ca92..ecf2fd9 100644 (file)
@@ -70,6 +70,11 @@ long_usage = do
      dump ('$':'$':s) = hPutStr stderr get_prog_name >> dump s
      dump (c:s) = hPutChar stderr c >> dump s
 
+version_str = _ProjectVersion ++ 
+               ( if _ProjectPatchLevel /= "0" && _ProjectPatchLevel /= ""
+                       then '.':_ProjectPatchLevel
+                       else "")
+
 -----------------------------------------------------------------------------
 -- Phases
 
@@ -1609,10 +1614,11 @@ opts =
   
 
       ------- version ----------------------------------------------------
-  ,  ( "-version"      , NoArg (do hPutStrLn stderr (_ProjectName
-                                     ++ ", version " ++ _ProjectVersion
-                                     ++ ", patchlevel " ++ _ProjectPatchLevel)
-                                   exitWith ExitSuccess))
+  ,  ( "-version"       , NoArg (do hPutStrLn stderr (_ProjectName
+                                     ++ ", version " ++ version_str)
+                                    exitWith ExitSuccess))
+  ,  ( "-numeric-version", NoArg (do hPutStrLn stderr version_str
+                                    exitWith ExitSuccess))
 
       ------- verbosity ----------------------------------------------------
   ,  ( "v"             , NoArg (writeIORef verbose True) )