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