diff src/main.mlton.sml @ 1520:b5517f47b1f1

Tracking and printing of version numbers (based on a patch by Austin Seipp)
author Adam Chlipala <adam@chlipala.net>
date Tue, 02 Aug 2011 13:33:38 -0400
parents 9cb923efea4d
children 7efcf8f4a44a
line wrap: on
line diff
--- a/src/main.mlton.sml	Sun Jul 24 15:47:09 2011 -0400
+++ b/src/main.mlton.sml	Tue Aug 02 13:33:38 2011 -0400
@@ -32,9 +32,18 @@
 val tutorial = ref false
 val css = ref false
 
+fun printVersion () = (print (Config.versionString ^ "\n");
+		       OS.Process.exit OS.Process.success)
+fun printNumericVersion () = (print (Config.versionNumber ^ "\n");
+			      OS.Process.exit OS.Process.success)
+
 fun doArgs args =
     case args of
         [] => ()
+      | "-version" :: rest => 
+	printVersion ()
+      | "-numeric-version" :: rest =>
+	printNumericVersion ()
       | "-css" :: rest =>
         (css := true;
          doArgs rest)
@@ -119,7 +128,7 @@
 val job =
     case !sources of
         [file] => file
-      | _ => raise Fail "Zero or multiple job files specified"
+      | _ => printVersion ()
 
 val () =
     case (!css, !demo, !tutorial) of