changeset 1335:79557535b843

-prefix command-line option
author Adam Chlipala <adam@chlipala.net>
date Sun, 12 Dec 2010 10:44:19 -0500
parents a1aa62b472cf
children 7eefe077075a
files doc/manual.tex src/compiler.sml src/main.mlton.sml
diffstat 3 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/doc/manual.tex	Sun Dec 12 10:35:04 2010 -0500
+++ b/doc/manual.tex	Sun Dec 12 10:44:19 2010 -0500
@@ -238,6 +238,8 @@
 
 \item \texttt{-path NAME VALUE}: Set the value of path variable \texttt{\$NAME} to \texttt{VALUE}, for use in \texttt{.urp} files.
 
+\item \texttt{-prefix PREFIX}: Equivalent to the \texttt{prefix} directive from \texttt{.urp} files
+
 \item \texttt{-protocol [http|cgi|fastcgi]}: Set the protocol that the generated application speaks.
   \begin{itemize}
   \item \texttt{http}: This is the default.  It is for building standalone web servers that can be accessed by web browsers directly.
--- a/src/compiler.sml	Sun Dec 12 10:35:04 2010 -0500
+++ b/src/compiler.sml	Sun Dec 12 10:44:19 2010 -0500
@@ -445,7 +445,7 @@
                                 readSources acc
                             end
 
-                    val prefix = ref NONE
+                    val prefix = ref (case Settings.getUrlPrefix () of "/" => NONE | s => SOME s)
                     val database = ref (Settings.getDbstring ())
                     val exe = ref (Settings.getExe ())
                     val sql = ref (Settings.getSql ())
--- a/src/main.mlton.sml	Sun Dec 12 10:35:04 2010 -0500
+++ b/src/main.mlton.sml	Sun Dec 12 10:44:19 2010 -0500
@@ -46,6 +46,9 @@
       | "-protocol" :: name :: rest =>
         (Settings.setProtocol name;
          doArgs rest)
+      | "-prefix" :: prefix :: rest =>
+        (Settings.setUrlPrefix prefix;
+         doArgs rest)
       | "-db" :: s :: rest =>
         (Settings.setDbstring (SOME s);
          doArgs rest)