on master help sign in
Add option to display location of elm_runtime.js
commit8a6c7b0bc4d973bd3f03a4a63aaac5a92eaee813 authorMax New <maxsnew@gmail.com> dateFri 2 May 2014, 11:02 (13 years ago) parent0f894b8
2 files changed+10−3
compiler/Build/Flags.hs+4−1 compiler/Compiler.hs+6−2
compiler/Build/Flags.hs+4−1
@@ -15,6 +15,7 @@ data Flags = Flags
1515 , cache_dir :: FilePath
1616 , build_dir :: FilePath
1717 , src_dir :: [FilePath]
18+ , show_runtime :: Bool
1819 }
1920 deriving (Data,Typeable,Show,Eq)
2021
@@ -37,7 +38,9 @@ flags = Flags
3738 , src_dir = ["."] &= typFile
3839 &= help "Additional source directories besides project root. Searched when using --make"
3940 , print_types = False
40− &= help "Print out infered types of top-level definitions."
41+ &= help "Print out inferred types of top-level definitions."
42+ , show_runtime = False
43+ &= help "Print the absolute path to the default Elm runtime."
4144 } &= help "Compile Elm programs to HTML, CSS, and JavaScript."
4245 &= helpArg [explicit, name "help", name "h"]
4346 &= versionArg [explicit, name "version", name "v", summary (show Version.elmVersion)]
compiler/Compiler.hs+6−2
@@ -1,12 +1,13 @@
11{-# OPTIONS_GHC -W #-}
22module Main where
33
4−import Control.Monad (foldM)
4+import Control.Monad (foldM, when)
55import qualified Data.Maybe as Maybe
66import Text.Blaze.Html.Renderer.String (renderHtml)
77import qualified Data.ByteString.Lazy.Char8 as BS
88import qualified System.Console.CmdArgs as CmdArgs
99import System.Directory
10+import System.Exit (exitSuccess)
1011import System.FilePath
1112import GHC.Conc
1213
@@ -24,7 +25,10 @@ main = do setNumCapabilities =<< getNumProcessors
2425
2526compileArgs :: Flag.Flags -> IO ()
2627compileArgs flags =
27− case Flag.files flags of
28+ do when (Flag.show_runtime flags) $
29+ do putStrLn Path.runtime
30+ exitSuccess
31+ case Flag.files flags of
2832 [] -> putStrLn "Usage: elm [OPTIONS] [FILES]\nFor more help: elm --help"
2933 fs -> mapM_ (build flags) fs
3034