3import Data.List (isPrefixOf)
6import System.Environment
7import Text.Blaze.Html.Renderer.String (renderHtml)
9main = getArgs >>= parse
11parse ("--help":_) = putStrLn usage
12parse ("--version":_) = putStrLn "The Elm Compiler 0.1.1.7"
14 | "--runtime-location=" `isPrefixOf` loc =
15 produceHtml (tail $ dropWhile (/='=') loc) file
16 | otherwise = putStrLn usageMini
17parse [file] = produceHtml "elm-mini.js" file
18parse _ = putStrLn usageMini
20produceHtml libLoc file = do
22 let name = takeWhile (/='.') file
24 Left err -> putStrLn err
25 Right jsCode -> writeFile (name ++ ".html") . renderHtml $
26 generateHtml libLoc name jsCode
29 "Usage: elm [OPTIONS] FILE\n\
30 \Try `elm --help' for more information."
33 "Usage: elm [OPTIONS] FILE\n\
34 \Compile .elm files to .html files.\n\
35 \Example: elm --runtime-location=../elm-mini.js main.elm\n\
37 \Resource Locations:\n\
38 \ --runtime-location set the location of the Elm runtime (elm-mini.js)\n\
40 \Compiler Information:\n\
41 \ --version print the version information and exit\n\
42 \ --help display this help and exit\n\
44 \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