diff options
author | 2011-08-02 13:33:38 -0400 | |
---|---|---|
committer | 2011-08-02 13:33:38 -0400 | |
commit | d727966ce805067e227fa96262005056fdfac448 (patch) | |
tree | bddb0a36e8b85f6742e31a47db77399b24b3fd36 /src | |
parent | 729998f64e891856f43f758551be0aaa26ac89b4 (diff) |
Tracking and printing of version numbers (based on a patch by Austin Seipp)
Diffstat (limited to 'src')
-rw-r--r-- | src/config.sig | 3 | ||||
-rw-r--r-- | src/config.sml.in | 3 | ||||
-rw-r--r-- | src/main.mlton.sml | 11 |
3 files changed, 16 insertions, 1 deletions
diff --git a/src/config.sig b/src/config.sig index da26da2f..98455a3c 100644 --- a/src/config.sig +++ b/src/config.sig @@ -15,4 +15,7 @@ signature CONFIG = sig val pgheader : string val msheader : string val sqheader : string + + val versionNumber : string + val versionString : string end diff --git a/src/config.sml.in b/src/config.sml.in index 3fc492ab..bb5648c9 100644 --- a/src/config.sml.in +++ b/src/config.sml.in @@ -20,4 +20,7 @@ val pgheader = "@PGHEADER@" val msheader = "@MSHEADER@" val sqheader = "@SQHEADER@" +val versionNumber = "@VERSION@" +val versionString = "The Ur/Web compiler, version " ^ versionNumber + end diff --git a/src/main.mlton.sml b/src/main.mlton.sml index 0c6f96ba..c26a9d10 100644 --- a/src/main.mlton.sml +++ b/src/main.mlton.sml @@ -32,9 +32,18 @@ val demo = ref (NONE : (string * bool) option) 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 () = doArgs (CommandLine.arguments ()) val job = case !sources of [file] => file - | _ => raise Fail "Zero or multiple job files specified" + | _ => printVersion () val () = case (!css, !demo, !tutorial) of |