on master help sign in
Add option to display location of elm_runtime.js
8a6c7b0Max New
compiler/Build/Flags.hs+4−1
@@ -15,6 +15,7 @@ data Flags = Flags
15 , cache_dir :: FilePath
15 , cache_dir :: FilePath
16 , build_dir :: FilePath
16 , build_dir :: FilePath
17 , src_dir :: [FilePath]
17 , src_dir :: [FilePath]
18+ , show_runtime :: Bool
18 }
19 }
19 deriving (Data,Typeable,Show,Eq)
20 deriving (Data,Typeable,Show,Eq)
20
21
@@ -37,7 +38,9 @@ flags = Flags
37 , src_dir = ["."] &= typFile
38 , src_dir = ["."] &= typFile
38 &= help "Additional source directories besides project root. Searched when using --make"
39 &= help "Additional source directories besides project root. Searched when using --make"
39 , print_types = False
40 , 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."
41 } &= help "Compile Elm programs to HTML, CSS, and JavaScript."
44 } &= help "Compile Elm programs to HTML, CSS, and JavaScript."
42 &= helpArg [explicit, name "help", name "h"]
45 &= helpArg [explicit, name "help", name "h"]
43 &= versionArg [explicit, name "version", name "v", summary (show Version.elmVersion)]
46 &= versionArg [explicit, name "version", name "v", summary (show Version.elmVersion)]
compiler/Compiler.hs+6−2
@@ -1,12 +1,13 @@
1{-# OPTIONS_GHC -W #-}
1{-# OPTIONS_GHC -W #-}
2module Main where
2module Main where
3
3
4−import Control.Monad (foldM)
4+import Control.Monad (foldM, when)
5import qualified Data.Maybe as Maybe
5import qualified Data.Maybe as Maybe
6import Text.Blaze.Html.Renderer.String (renderHtml)
6import Text.Blaze.Html.Renderer.String (renderHtml)
7import qualified Data.ByteString.Lazy.Char8 as BS
7import qualified Data.ByteString.Lazy.Char8 as BS
8import qualified System.Console.CmdArgs as CmdArgs
8import qualified System.Console.CmdArgs as CmdArgs
9import System.Directory
9import System.Directory
10+import System.Exit (exitSuccess)
10import System.FilePath
11import System.FilePath
11import GHC.Conc
12import GHC.Conc
12
13
@@ -24,7 +25,10 @@ main = do setNumCapabilities =<< getNumProcessors
24
25
25compileArgs :: Flag.Flags -> IO ()
26compileArgs :: Flag.Flags -> IO ()
26compileArgs flags =
27compileArgs flags =
28+ do when (Flag.show_runtime flags) $
29+ do putStrLn Path.runtime
30+ exitSuccess
27− case Flag.files flags of
31+ case Flag.files flags of
28 [] -> putStrLn "Usage: elm [OPTIONS] [FILES]\nFor more help: elm --help"
32 [] -> putStrLn "Usage: elm [OPTIONS] [FILES]\nFor more help: elm --help"
29 fs -> mapM_ (build flags) fs
33 fs -> mapM_ (build flags) fs
30
34