comparison 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
comparison
equal deleted inserted replaced
1519:ada582d07ae1 1520:b5517f47b1f1
30 val sources = ref ([] : string list) 30 val sources = ref ([] : string list)
31 val demo = ref (NONE : (string * bool) option) 31 val demo = ref (NONE : (string * bool) option)
32 val tutorial = ref false 32 val tutorial = ref false
33 val css = ref false 33 val css = ref false
34 34
35 fun printVersion () = (print (Config.versionString ^ "\n");
36 OS.Process.exit OS.Process.success)
37 fun printNumericVersion () = (print (Config.versionNumber ^ "\n");
38 OS.Process.exit OS.Process.success)
39
35 fun doArgs args = 40 fun doArgs args =
36 case args of 41 case args of
37 [] => () 42 [] => ()
43 | "-version" :: rest =>
44 printVersion ()
45 | "-numeric-version" :: rest =>
46 printNumericVersion ()
38 | "-css" :: rest => 47 | "-css" :: rest =>
39 (css := true; 48 (css := true;
40 doArgs rest) 49 doArgs rest)
41 | "-demo" :: prefix :: rest => 50 | "-demo" :: prefix :: rest =>
42 (demo := SOME (prefix, false); 51 (demo := SOME (prefix, false);
117 val () = doArgs (CommandLine.arguments ()) 126 val () = doArgs (CommandLine.arguments ())
118 127
119 val job = 128 val job =
120 case !sources of 129 case !sources of
121 [file] => file 130 [file] => file
122 | _ => raise Fail "Zero or multiple job files specified" 131 | _ => printVersion ()
123 132
124 val () = 133 val () =
125 case (!css, !demo, !tutorial) of 134 case (!css, !demo, !tutorial) of
126 (true, _, _) => 135 (true, _, _) =>
127 (case Compiler.run Compiler.toCss job of 136 (case Compiler.run Compiler.toCss job of