on e69bf68 help sign in
elk/src/Build/Flags.hs
64 lines 2.1 kB history raw
1{-# LANGUAGE DeriveDataTypeable #-}
2module Build.Flags where
4import qualified Elm.Compiler.Version as Compiler
5import System.Console.CmdArgs
8data Flags = Flags
9 { make :: Bool
10 , files :: [FilePath]
11 , set_runtime :: Maybe FilePath
12 , get_runtime :: Bool
13 , bundle_runtime :: Bool
14 , only_js :: Bool
15 , print_types :: Bool
16 , scripts :: [FilePath]
17 , no_prelude :: Bool
18 , cache_dir :: FilePath
19 , build_dir :: FilePath
20 , src_dir :: [FilePath]
21 }
22 deriving (Data,Typeable,Show,Eq)
24flags :: Flags
25flags = Flags
26 { files = def &= args &= typ "FILES"
28 , make = False
29 &= help "automatically compile dependencies."
31 , only_js = False
32 &= help "Compile only to JavaScript."
34 , no_prelude = False
35 &= help "Do not import Prelude by default, used only when compiling standard libraries."
37 , scripts = [] &= typFile
38 &= help "Load JavaScript files in generated HTML. Files will be included in the given order."
40 , set_runtime = Nothing &= typFile
41 &= help "Specify a custom location for Elm's runtime system."
43 , get_runtime = False
44 &= help "Print the absolute path to the default Elm runtime."
46 , bundle_runtime = False
47 &= help "Bundle the runtime with the generated html or js to create a standalone file."
49 , cache_dir = "cache" &= typFile
50 &= help "Directory for files cached to make builds faster. Defaults to cache/ directory."
52 , build_dir = "build" &= typFile
53 &= help "Directory for generated HTML and JS files. Defaults to build/ directory."
55 , src_dir = ["."] &= typFile
56 &= help "Additional source directories besides project root. Searched when using --make"
58 , print_types = False
59 &= help "Print out inferred types of top-level definitions."
61 } &= help "Compile Elm programs to HTML, CSS, and JavaScript."
62 &= helpArg [explicit, name "help", name "h"]
63 &= versionArg [explicit, name "version", name "v", summary Compiler.version]
64 &= summary ("The Elm Compiler " ++ Compiler.version ++ ", (c) Evan Czaplicki 2011-2014")