4import System.Environment
6import Data.List (isPrefixOf)
8import Text.Blaze.Html.Renderer.String (renderHtml)
10main = getArgs >>= parse
12parse ("--help":_) = putStrLn usage
13parse ("--version":_) = putStrLn "The Elm Compiler 0.1.1.6"
15 | "--runtime-location=" `isPrefixOf` loc =
16 produceHtml (tail $ dropWhile (/='=') loc) file
17 | otherwise = putStrLn usageMini
18parse [file] = produceHtml "elm-mini.js" file
19parse _ = putStrLn usageMini
21produceHtml libLoc file = do
23 let name = takeWhile (/='.') file
25 Left err -> putStrLn err
26 Right jsCode -> writeFile (name ++ ".html") . renderHtml $
27 generateHtml libLoc name jsCode
30 "Usage: elm [OPTIONS] FILE\n\
31 \Try `elm --help' for more information."
34 "Usage: elm [OPTIONS] FILE\n\
35 \Compile .elm files to .html files.\n\
36 \Example: elm --runtime-location=../elm-mini.js main.elm\n\
38 \Resource Locations:\n\
39 \ --runtime-location set the location of the Elm runtime (elm-mini.js)\n\
41 \Compiler Information:\n\
42 \ --version print the version information and exit\n\
43 \ --help display this help and exit\n\
45 \Elm home page: <http://elm-lang.org>"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list